How to generate on the fly images with image_lib? |
[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.
[eluser]JoostV[/eluser]
Create a controller that outputs the image, image_lib setting 'dynamic_output' set to true, see http://ellislab.com/codeigniter/user-gui...e_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.
[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.
[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, |
Welcome Guest, Not a member yet? Register Sign In |