Hi Johny,
Just some thoughts about the solution you found:
The width and height properties in your <img>-tag are just properties to display the image. However, the full image data are sent over the network. Imagin you have a preview page of 50 pictures, making 2 MB each, you need to send 100 MB, just to display some thumbnails !
Maybe some solutions to work around this problem:
you might want to store a thumbnail preview of you full image also in the database; if your server has the appropriate image-manipulation-tools installed, you could do it on-the-fly while uploading the image. This way, you do the job only once.
Preferrably, you could size the thumbnail with appropriate height/width ratio
Eventually, it might be possible to generate the thumbnail on-the-fly while generating preview content, instead of leaving this to the browser. keeping width/height ratio wouldn't be much trouble in the same step.
I'd prefer the first solution: it won't eat up much more storage than storing the full picture, and resizing has to be done only once. If you resize image at each retrieval, this might be an issue depending on the performance of your server, as well as downloading full-size pictures might be an issue with available bandwith or amount of transferrable data (if you need to pay for each MB, you might run into trouble ...)
It is up to you to think about all this, because you know approximately the number of pictures to treat, the number of page calls, you storage or bandwidth capacity, etc.
HTH
Greetings,
Jean-Jacques
(I already did some reflections about doing this resizing stuff, but so far I did not yet write one single line of code, so I can't give you a plug-and-play solution for it ...)
See the manual of PHP functions about "Exif functions" and "Image functions"