CodeIgniter Forums
Image upload best practices - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Image upload best practices (/showthread.php?tid=31098)



Image upload best practices - El Forum - 06-06-2010

[eluser]bondjp[/eluser]
Hi, i would like to know how you guys handle image uploads for user profiles.
I need to do it but i don't know the best way to do it.

Is this the way?:

1- upload original ex: 1024x768
2- save it to images dir
2- resize image ex: 80x80
3- save it to images/thumbnails dir
4- update db original image path
5- update db resized image path
6- When showing user profile load the original image(/images) and resize it ex: 200x200????
7- when showing users load the thumbnails (/images/thumbnails)


6- Isn't this a bad way since i'll be loading a full size image?
Thanks


Image upload best practices - El Forum - 06-06-2010

[eluser]Benito[/eluser]
Hi!
Up to #5 I think you are upload, resize and set meta info to DB.
What I dont get is #6-7?! What are you trying to do? It is always a waste of
resources to load an image in its original size then resize it with html. Why in the world
would you want to do that?


Image upload best practices - El Forum - 06-06-2010

[eluser]bondjp[/eluser]
[quote author="Benito" date="1275876511"]Hi!
Up to #5 I think you are upload, resize and set meta info to DB.
What I dont get is #6-7?! What are you trying to do? It is always a waste of
resources to load an image in its original size then resize it with html. Why in the world
would you want to do that?[/quote]

I don't, i just want to know how to do it without uploading the original image.
I want to show the thumbnails on a search result and a bigger image than the thumbnails on the users profile.
How can i make this work?