Resize images on the fly and output/display them in views |
[eluser]CARP[/eluser]
Hi ppl I'm becoming crazy trying to make a function to output a resized image - I want to display some images (resized) in a view So, I've created a library with a function that resizes the images and does something like this Code: ...elseif($the_ext == 'gif') And, in my views... i have something like Code: <img >mylib->resize($imagepath, $maxw, $maxh); ?>" /> But I see blanks... the imagepath is correct, the resize function works, the library loads... Any ideas? Thanks
[eluser]ClaudioX[/eluser]
I use image_moo to do something like this. http://ellislab.com/forums/viewreply/908735/ Maybe its help
[eluser]appleboy[/eluser]
Could you paste your all source code of library, controller and views? or provide test url?
[eluser]ClaudioX[/eluser]
This is my full set: Controller: Code: public function get_image() In model, to encode/decode the image name (for utf-8 images name): Code: public function setSpecialChar($string){ the img tag generation (in model): Code: $last_change = filemtime( utf8_decode($folder.$img) );
[eluser]CARP[/eluser]
Hi guys Sorry for late response, but after reading all replies, tried using image_moo but no luck yet I'm pasting you the code of my controller and view so you can give me a hand please: Controller http://snipt.org/xmkkj View http://snipt.org/xmkkk Logic: - Controller loads a classifieds model and gets a random featured - Controller loads the featured view with the data obtained from model - View shows featured classified with its image (the image calls again to a function in pub controller) My problem is that the image is not displayed (although i call the function alone and i can save the image from firefox correctly so the lib works) Thanks again
[eluser]appleboy[/eluser]
I think that the error occur on your views. Code: <?php you can print site_url("pub/getimg/$imagencargar") string, and check files exists? please check or replace the following code. Code: $imagencargar = getcwd()."\\".$rowimage->imagen_default;
[eluser]CARP[/eluser]
I know i'm playin dirty sending imagepath as a parameter of the controller's function Is there a way to encode in md5 or something similar and decode in the controler function? I guess that way there won't be error about characters, etc. Am I right? Thanks
[eluser]ClaudioX[/eluser]
If i understand correctly, look my previous reply, this is why i use base_64 and utf8_encode.
[eluser]CARP[/eluser]
Hi people Doing the changes you proposed, encoding the path in base64, etc. made everything to work Thanks !!! http://i.imgur.com/UNni3.jpg |
Welcome Guest, Not a member yet? Register Sign In |