Welcome Guest, Not a member yet? Register   Sign In
image_lib works sporadically
#1

[eluser]matches[/eluser]
Below is the code I am using to create thumb nails. For some reason it works about 1 out of every 30 times. Any idea why?

This is the error I get when it doesn't work:

Quote:The path to the image is not correct.
Your server does not support the GD function required to process this type of image.

Keep in mind I make no changes to the code. I just keep trying and it will eventually create a thumb.

Code:
function _createThumbnail($fileName, $upload_directory) {
        $config['image_library'] = 'gd2';
        $config['source_image'] = $upload_directory . $fileName;
        $config['new_image'] = $upload_directory . $fileName;
        $config['dest_image'] = $upload_directory;
        $config['create_thumb'] = TRUE;
        $config['maintain_ratio'] = TRUE;
        $config['width'] = 75;
        $config['height'] = 75;
        
        echo $upload_directory . $fileName;
        
        $this->load->library('image_lib', $config);
        if(!$this->image_lib->resize()) echo $this->image_lib->display_errors();
}
#2

[eluser]adityamenon[/eluser]
Maybe it's a permissions problem? Does the folder you are creating thumbnails in have a read/write permission? If you're on Apache, setting the permission to 750 usually solves this kind of a thing.




Theme © iAndrew 2016 - Forum software by © MyBB