![]() |
image manipulation, resize adn unique name - 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: image manipulation, resize adn unique name (/showthread.php?tid=50885) |
image manipulation, resize adn unique name - El Forum - 04-13-2012 [eluser]the_unforgiven[/eluser] Nothing still, still not resizing and not puttin the thumb into thumbs folder. image manipulation, resize adn unique name - El Forum - 04-13-2012 [eluser]the_unforgiven[/eluser] And i cant seem to echo $config[‘source_image’] image manipulation, resize adn unique name - El Forum - 04-13-2012 [eluser]LynxCoder[/eluser] [quote author="the_unforgiven" date="1334310470"]And i cant seem to echo $config[‘source_image’][/quote] Ok, are you 100% sure that $config['sourceimage'] contains the correct path? Can you echo the two component parts - the path and the filename? That would confirm that the right value is being passed. If the new_image tag is now set correctly to include a filename, and its not resizing, that would suggest to me that its not finding the original file. Do you have CI set to show errors? It may also be worth looking in the CI log to find out is anything is being mentioned in there? Rich image manipulation, resize adn unique name - El Forum - 04-13-2012 [eluser]the_unforgiven[/eluser] Heres the code again Code: function _do_upload_file() I don't get any errors, it uploads, but just doesn't resize and put the rezised image into thumbs folder. Checking the CI Log now to see if there's anything in there. image manipulation, resize adn unique name - El Forum - 04-13-2012 [eluser]the_unforgiven[/eluser] Nothing in logs to state otherwise, plus I always have the php_error log console open on my mac whilst coding. image manipulation, resize adn unique name - El Forum - 04-13-2012 [eluser]LynxCoder[/eluser] [quote author="the_unforgiven" date="1334312348"] Code: $config['height'] = 100; Ok, before the above line add Code: echo $this->upload->upload_path.$this->upload->file_name . "<BR>"; That will do two things, provide that the resize code is being executed, and also output where it thinks its finding the file. I would then manually check that that path is exactly correct, and that the file is there. Also might just be worth removing the '_' before the thumbs.jpg - filename in 'new_image' it shouldn't cause a problem on a Mac (im on a iMac too btw) but just in case. Everything in the code looks right to me, so its got to be related to either getting the original image or resaving the resized version in my view. Rich image manipulation, resize adn unique name - El Forum - 04-13-2012 [eluser]the_unforgiven[/eluser] Well f**k a duck!!! My mistake after about two hours last night and a good hour this morning foudn it with your help too of course, i'd not specified the path and url corrdtly so i went to download the image manip tut from nettuts and looked at the code Burak does and noticed the vars for gallery path and gallery url were inc orrect and what do you know it now upload orginal image and a thumb to thumbs folder. LynxCoder (like the username by the way) thanks for you help much appreciated, image manipulation, resize adn unique name - El Forum - 04-13-2012 [eluser]the_unforgiven[/eluser] My next question is what do i use to get the thumb stored to the db, currently have: Code: $image_data = $this->upload->data(); At the end of my model, so now i have a new row in my database called thumb and want to store the thumb ion the database from the thumbs folder. How does one acheive this? image manipulation, resize adn unique name - El Forum - 04-13-2012 [eluser]LynxCoder[/eluser] [quote author="the_unforgiven" date="1334315251"] LynxCoder (like the username by the way) thanks for you help much appreciated,[/quote] Excellent! Glad it all works! My usual point to start debugging is to echo out the variables and say what have i buggered up!!! Your welcome anyway! [quote author="the_unforgiven" date="1334315630"]My next question is what do i use to get the thumb stored to the db, currently have: Code: $image_data = $this->upload->data(); I'm assuming that your storing the reference to the filename and not the actual thumbnail? In which case its just a simple case of doing Code: $this->db->where('uniqueid',$UID); Assuming that a record already exists in the table and your just updating it with the thumbnail filename - in which case you should already have the $UID - obviously replace 'uniqueid' and 'tablename' with the appropriate values. EDIT: I'm assuming that the fieldname in the table is 'item_img', if not, then you need to change $data['item_img'] to be $data['fieldname'], replacing fieldname with the appropriate fieldname of course!! Alternatively, if you are just adding the thumbnail as a fresh record then Code: $this->db->insert('tablename',$data); plus any other data your looking to store alongside it of course! Assuming that all your thumbnails are stored in the same folder, then you only need to store the actual filename in the DB, not the path, which will reduce the data footprint of the DB. If thumbnails are stored in various places, then you'll need to store the path too. image manipulation, resize adn unique name - El Forum - 04-13-2012 [eluser]the_unforgiven[/eluser] All images are uploaded to uploads folder the orginals. Thumbs are uploaded to uploads/thumbs then the filename which will be for example: aimage_thumb.png whereas the orginal will just be aimage.png soo what i want to do using this model i have you will see the commented out line is what i want to achieve: Code: function addItem(){ |