Images in CodeIgniter, how to? |
[eluser]Sinclair[/eluser]
Hi, once again, thanks for the reply. I upload the images by FTP and insert data directly to the database because I will be the only user/administrator of the website. I think this code generate UUID's only using a function: http://oxygene.sk/lukas/2009/10/uuid-gen...n-plpgsql/ The problem with this is that I need to change the name of the .jpg by hand. What I was thinking to do is store the images outside public_html, but my problem is that I need to use image_lib to generate thumbnails on the fly, and I don't know if I can do this with images outside public_html. Besides that, I will use the watermarked images by image_lib in a ajax script... And as I newbie at web developement I'am affraid of doing the process in the wrong way and not reach the objective... Best solution for this poor web application? Best Regards,
[eluser]JoostV[/eluser]
Do not ever create thumbnails on the fly unless you store them in cache or a thumbs folder. It is just too stressful on your webserver.
[eluser]Sinclair[/eluser]
[quote author="JoostV" date="1260107416"]Do not ever create thumbnails on the fly unless you store them in cache or a thumbs folder. It is just too stressful on your webserver.[/quote] Hi, thanks for the reply. And how I do that? You have any example? Best Regards,
[eluser]JoostV[/eluser]
On uploading an image simply watermark and resize the uploaded image and store it in a public directory. If you want to keep the original image too, watermark and resize a copy of the original image and store the original image in a different directory.
[eluser]Sinclair[/eluser]
[quote author="JoostV" date="1260124133"]On uploading an image simply watermark and resize the uploaded image and store it in a public directory. If you want to keep the original image too, watermark and resize a copy of the original image and store the original image in a different directory.[/quote] Thanks for the reply. As I said earlier, I don't have any backoffice to upload images. The upload of images will be done using FTP. I was thinking in the solution of store the original images outside of public_html and use image_lib to watermark and thumbnail because I don't want to make those tasks by hand. But I see that the general consensus is that this is not a good idea.
[eluser]Sinclair[/eluser]
Well, I start looking to test if the solution of store images outside public_html is possible. I have done a function "getImageFromOutside" Code: <?php Now, I need to know something. It is possible to use the value returned by the function and use that in "image_lib"? And where should I put this function? In helpers? Best Regards,
[eluser]JoostV[/eluser]
This is how you get a watermarked image from a folder and create that image if it does not yet exist. With a script like this you create thumbs the first time they are requested. The function goes into a library, so you can reuse it as you see fit. I did not test this script. You'll have to adjust as you go along) LIBRARY watermark.php Code: function getThumbnail ($thumbnailPath, $filePath, $folder, $file) CONTROLLER Code: $this->load->library('watermark'); |
Welcome Guest, Not a member yet? Register Sign In |