My android app needs different sized versions of images for different purpose and bandwidth preservation.
Approach one:
- when the user uploads their avatar or another image, my php script creates 4 versions of that image: mini_200, medium_300, big_400 and original. those paths are then taken and stored in the database. Then, when I need the smallest image, I load it from
http://myserver.com/item_images/200_mini_27304lkewsjfimage.jpg
Approach two:
- same as approach one, but instead of adding prefixes to the names of the files, I store them in different folders - big, medium, mini. and in My app I just pass a parameter for which folder to look in
Approach three:
- when the user uploads their avatar or another image, I only store the original. Then, when I need the smallest image, I load if this way:
http://myserver.com/image_resizer.php?image="93_iosdfj0sd9fj.jpg"&new_width=200&new_height=200
Which one is better and why? I feel like reinventing the wheel here, because this topic is too broad and I dont know where to read about it