![]() |
How to generate on the fly images with image_lib? - 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: How to generate on the fly images with image_lib? (/showthread.php?tid=25457) |
How to generate on the fly images with image_lib? - El Forum - 12-12-2009 [eluser]Sinclair[/eluser] Hi, I have been testing image_lib, but I can't generate on the fly images with them. There are some examples on how to generate on the fly images with image_lib? Best Regards. How to generate on the fly images with image_lib? - El Forum - 12-12-2009 [eluser]JoostV[/eluser] Create a controller that outputs the image, image_lib setting 'dynamic_output' set to true, see http://ellislab.com/codeigniter/user-guide/libraries/image_lib.html. Set this controller as your source. Code: // Assuming your controller name is 'image', method 'generate' NB Creating images on-the-fly puts a massive strain on your server. How to generate on the fly images with image_lib? - El Forum - 12-12-2009 [eluser]bretticus[/eluser] Another tip. You can easily use routes in CI to fake an image path like so (config/routes.php) Code: $route['d_images/some_image.jpg'] = "image/generate/some_image"; Now your image src path can look normal. Code: <img src="/d_images/some_image.jpg" alt="foo" /> Of course your generate method needs to dynamically produce the image. Here's a small snippet to demonstrate: Code: function generate() There are many image functions in PHP. See the PHP Manual for details. How to generate on the fly images with image_lib? - El Forum - 12-12-2009 [eluser]Sinclair[/eluser] Hi, First of all, thanks for the replys. I have found something that works, but I need to resize and watermark on the fly, whitout changing the original image file. I have to functions that I'am testing: Code: function get_photo($folder, $file){ This function, Watermarks On The Fly, but not resize. Code: function get_photo($folder, $file){ This function resize and watermarks, but when watermarking, change the image, add the watermark to the image withthe original image size. My question. How can I get real Resize and Watermarking On The Fly without changing the original image files? Can you give me some clues? Best Regards, |