Call-back icon  Sales: Call 877.832.5289 (N America)|310.295.4144 (International)

Magento

eCommerce Software for Online Growth

Magento Forum

   
GD extension got you down? 
 
Mark_Kimsal
Sr. Member
 
Total Posts:  186
Joined:  2007-09-12
Michigan, USA
 

I recently upgraded to 0.9 and found that it requires GD to show any product image.  It’s kind of ridiculous because 0.8 worked fine without GD.  Looking at the code the GD extension resizes all the images to the proper size and saves them in a cache.  I really hate running GD inside a regular Web request, but I was stuck because there’s nothing you can do to show the product image.

After digging through the code, i found some spots to throw some try catch and just send back the image that you have already uploaded.

In Mage/Catalog/Helper/Image.php around line 162

catch( Exception $e {

//@@CUSTOMIZED: use whatever image you have
            
$baseDir Mage::getBaseDir('media');
            
$path str_replace($baseDir DS""$this->_getModel()->getBaseFile());
            return 
Mage::getBaseUrl('media') . str_replace(DS'/'$path);
//@@CUSTOMIZED: use whatever image you have

//            $url = '';
        
}
        
if (!$url{
            $url 
Mage::getDesign()->getSkinUrl($this->getPlaceholder());
        
}
        
return $url;
    
}

This will return whatever image is available instead of blank if GD does not exist.  (Actually, it does it for any exception, you can add try catch blocks around $url = $this->_getModel()->saveFile()->getUrl(); and $this->_getModel()->resize(); if you want to really be specific)

 Signature 

There’s info on lots of custom modules in my Magento Group
http://www.magentocommerce.com/group/view/174
Need Upgrade help from 0.6, 0.7, and 0.8 available?  P.M. me for details on CMS integration.

 
Magento Community Magento Community
Magento Community
Magento Community
 
NinjaTech
Jr. Member
 
Avatar
Total Posts:  26
Joined:  2008-03-28
 

I seems like an easy matter for them to add a registry switch to turn on or off GD.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
 
Sales: Call 877.832.5289 (North America) 310.295.4144 (International)
© Copyright 2008 Varien. Magento, eCommerce software, is a trademark of Irubin Consulting Inc. DBA Varien
Privacy Policy|Terms of Service
Magento Community Count
52313 users|423 users currently online|105635 forum posts