Part of the EllisLab Network
   
 
Incorrect log message - image_lib
Posted: 05 March 2007 04:06 PM   [ Ignore ]  
Summer Student
Avatar
Total Posts:  19
Joined  03-02-2007

While I was trying to debug this function:

function resize_image($source_filename, $destination_filename, $height, $width, $keep_ratio = true) {
        $opt[
"image_library"] = 'GD';
        
$opt["source_image"] = $source_filename;
        
$opt["new_image"] = $destination_filename;
        
$opt["maintain_ratio"] = $keep_ratio;
        
$opt["height"] = $height;
        
$opt["width"] = $width;
        
        
$this->CI->image_lib->clear();
        
$this->CI->image_lib->initialize($opt);
        
$this->CI->image_lib->resize();
    
}


I got the following error messages in the log:

ERROR - 2007-03-05 14:31:42 --> You must specify a source image in your preferences.
ERROR - 2007-03-05 14:31:42 --> Your server does not support the GD function required to process this type of image.


The first message is clearly bogus. The second is also bogus, since according to phpinfo(), GD is enabled on my server. It turned out that the problem was that the destination directories weren’t writable. So, I ended up with no indication of the nature of the problem.

Profile
 
 
Posted: 05 March 2007 07:06 PM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  735
Joined  10-18-2006

The second error is probably because of the first… ‘cause if no source images is specified, no valid type of image is… however, I can’t understand why the first error happens

 Signature 

Once in a while I remember I use Twitter

Profile
 
 
Posted: 05 March 2007 08:24 PM   [ Ignore ]   [ # 2 ]  
Summer Student
Avatar
Total Posts:  19
Joined  03-02-2007

But the first error is bogus, because I’m calling the function with a valid image filename. Making the destination directory writable solves the errors.

Profile
 
 
Posted: 06 March 2007 04:59 AM   [ Ignore ]   [ # 3 ]  
Research Assistant
RankRankRank
Total Posts:  915
Joined  07-10-2006

Scott… is the file in gif format? If so, GD may not consider it to be a valid image file depending on what version of GD you are using.

GD stopped supporting gif at some point (around v1.3.2) after Unisys started to enforce their patents on the gif format. GD2 came about after the open source png format was developed. I think it takes an incoming gif and converts to png format internally. Older versions of GD released prior to the rash of Unisys lawsuits still exist on some sites. Buried on the TYPO3 site is a detailed summary of GD history before and after the Unisys patent controversy with explanations of what the older and newer versions can and cannot do, along with descriptions of odd GD behavior under certain circumstances.  It’s also possible to use ImageMagick (spelling) in conjunction with GD to workaround some of its limitations.

Profile
 
 
Posted: 06 March 2007 04:49 PM   [ Ignore ]   [ # 4 ]  
Summer Student
Avatar
Total Posts:  19
Joined  03-02-2007
esra - 06 March 2007 04:59 AM

Scott… is the file in gif format? If so, GD may not consider it to be a valid image file depending on what version of GD you are using.

GD stopped supporting gif at some point (around v1.3.2) after Unisys started to enforce their patents on the gif format. GD2 came about after the open source png format was developed. I think it takes an incoming gif and converts to png format internally. Older versions of GD released prior to the rash of Unisys lawsuits still exist on some sites. Buried on the TYPO3 site is a detailed summary of GD history before and after the Unisys patent controversy with explanations of what the older and newer versions can and cannot do, along with descriptions of odd GD behavior under certain circumstances.  It’s also possible to use ImageMagick (spelling) in conjunction with GD to workaround some of its limitations.

The files in question are JPEGs. But the format shouldn’t make any difference, because everything works fine if the destination directory is writable.

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 719, on June 06, 2008 10:16 AM
Total Registered Members: 66413 Total Logged-in Users: 37
Total Topics: 84753 Total Anonymous Users: 1
Total Replies: 454823 Total Guests: 228
Total Posts: 539576    
Members ( View Memberlist )
Newest Members:  byrooNirCalexmuellerkizerdrixcaptainredmuffquinodligtharttechsivamDjordjesammozza