![]() |
What solution for thumbnail / image size variation generation? - 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: What solution for thumbnail / image size variation generation? (/showthread.php?tid=10779) |
What solution for thumbnail / image size variation generation? - El Forum - 08-12-2008 [eluser]Skinnpenal[/eluser] Hi guys! What solution do you use for generating image size variations? (in the setting where you'd have a web-app where users could upload images for use in articles and other content) I generally come across two solutions: 1. Generate variations in predefined sizes uppon upload 2. Generate a variation uppon request None of these sticks out as an optimal solution to me. Some concerns: For solution #1 you'd generate all variations for all files, so most likely you'd end up with a lot of files that would never be used. But the main issue here as I see it is if the design changes and the need for image size variations with it. For solution #2 you'd get around the issue above, but the only way to define sizes would be in the url somehow, and even though cached a person up to no good could easily create tons of requests by changing the size a pixel and I'd risk both running out of cpu/ram in the resizing process and out of hd space for the results. I'm sort of leaning towards solution #2, but are there any ways to avoid its issues? What solution for thumbnail / image size variation generation? - El Forum - 03-11-2009 [eluser]Mat-Moo[/eluser] Why not create a hybrid solution. Use option 2 but cache the generated image, if it exists then simply serve it, otherwise generate and serve it. This way if you have any major design changes you can simply wipe the cach. For each image you generate add a prefix to designate the size, e.g. _500_xyz.jpg so you know it's a temp image and easy to check if it exists. What solution for thumbnail / image size variation generation? - El Forum - 03-11-2009 [eluser]Vi.[/eluser] I am using on-the-fly thumbnails with defined maximum size. Mat-Moo's suggestion is what you need but It takes a bit time to complete. Because, after updating picture, content etc. , old picture can be displayed again. Solution #2 good for small project/web site but for big project/web site you can use Mat-Moo's solution. |