![]() |
image manipulation library - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: image manipulation library (/showthread.php?tid=34780) |
image manipulation library - El Forum - 10-09-2010 [eluser]Ngulo[/eluser] hi all, i'm trying to resize uploaded images but it doesn't work for me this code: Code: $img = htmlentities($_FILES['logo']['name']); any suggestion? really thanks guys ![]() image manipulation library - El Forum - 10-09-2010 [eluser]cahva[/eluser] Where does $postLogoTemp come from in move_uploaded_file()? I think it should be $imgTemp. And dont use htmlentities with $_FILES['logo']['tmp_name']. So better would be: Code: $img = htmlentities($_FILES['logo']['name']); image manipulation library - El Forum - 10-09-2010 [eluser]pickupman[/eluser] Why not use the upload class to handle the upload? There is also a function to sanitize the filename for security purposes. Try using the full file path to the image. Code: $config['source_image'] = $_SERVER['DOCUMENT_ROOT'] . 'uploads/img/'.$img); Or something similar based on your path. image manipulation library - El Forum - 10-09-2010 [eluser]Ngulo[/eluser] @cahva sorry man you're right at all!! the code i post before is not right it is as shown: Code: $img = htmlentities($_FILES['logo']['name']); the fact is that the path to the image to resize() is right to...but he's still not resizing me images :/ a make an echo of $config['source_image'] = $_SERVER['DOCUMENT_ROOT'] . 'uploads/img/'.$img); and then if i put this path into url i can see the image...but it is not resized() :/ image manipulation library - El Forum - 10-09-2010 [eluser]pickupman[/eluser] Maybe something minor, but from the user guide: Quote:Note: In order for the image class to be allowed to do any processing, the image file must have "write" file permissions. For example, 777. If you using your own upload method try using: Code: chmod($_SERVER['DOCUMENT_ROOT'] . 'uploads/img/'.$img, 0777); Your file permission is probably 644 as a guess. image manipulation library - El Forum - 10-09-2010 [eluser]Ngulo[/eluser] uhmm...... i'm on localhost could be this the main problem? :/ if i try using chmod i receive error message: Message: chmod() [function.chmod]: No such file or directory uhm....really strange :/ image manipulation library - El Forum - 10-09-2010 [eluser]pickupman[/eluser] are you on windows or on Linux? If you are on Linux, the file path must be off. On windows you quite need the same permissions as is either read only or writable. If you are on windows just make sure the folder permissions is set on users. image manipulation library - El Forum - 10-09-2010 [eluser]Ngulo[/eluser] !!!! i fixed it!!! the trick was this :/ $this->load->library('image_lib); $this->image_lib->initialize($config); thanks all guys anyway!!!!!! ![]() image manipulation library - El Forum - 10-09-2010 [eluser]pickupman[/eluser] Great...that's weird it wasn't taking the array as the second parameter. Most CI libraries take an array into the class constructor and call $this->initialize($config); image manipulation library - El Forum - 10-09-2010 [eluser]Ngulo[/eluser] yes pickupman ![]() it was just to output a var_dump() and see ![]() sorry ![]() |