Skip to content
Advertisement

Save thumbnail image to another folder [CodeIgniter]

I’m trying to create a thumbnail for the image that will be uploaded to my server. Refer to https://www.codeigniter.com/userguide3/libraries/image_lib.html#processing-an-image . After the creation, I want to save the thumbnail to another folder since both the original image and the thumbnail will be saved in the same location.

So, I try using move_uploaded_file() function but it unable to move the file. I’m not really sure if my code is correctly done. Check it out.

Belwo is the my code :

JavaScript

Advertisement

Answer

Hope this will help you :

Use new_image in your $configer to change the folder path : $config['new_image'] = '/path/to/new_image.jpg';

Note : If only the new image name is specified it will be placed in the same folder as the original

If only the path is specified, the new image will be placed in the destination with the same name as the original.

If both the path and image name are specified it will placed in its own destination and given the new name.

Your code should be like this :

JavaScript

For more : https://www.codeigniter.com/user_guide/libraries/image_lib.html#CI_Image_lib::resize

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement