kudzu
kudzu

Reputation: 105

How to determine whether an image is optimized?

Ive got a strange task. Specifically i want to check for insane media file sizes for now. If possible, it would be nice if i could take image dimensions into consideration as well. For example, it's acceptable if a large image takes up 80kb, but not for a 20x20 px image.

Upvotes: 1

Views: 495

Answers (1)

Jakub
Jakub

Reputation: 20475

Going off @BoltClock's comment, you would need to define what makes an image optimized vs non-optimized.

Something like a definition table to go off of in your validation:

  • Maximum image size = 1MB X 2000px x 2000px
  • Relative Ratio of size to dimensions of file

The above could be checked easily (without GD for instance) using something like the getimagesize() function.

Upvotes: 1

Related Questions