How to set image path with CDN?

By default, image path is media/jmslideshow, actual image path is http://magibooks.com/media/resized/m…04_910_608.jpg

I am expecting to use something like <a href="http://media&#8221; target=”_blank”>http://media.magibooks.com/media/resized/media/jmslideshow/product04_910_608.jpg

How can I specify the cdn path media.magibooks.com instead of relative path media/jmslideshow? Do I need to modify the source code?

1 answer

Profile photo of Sherlock 0.00 $tone October 1, 2013
Public

Hi mate,

you can open the file of app\code\local\JoomlArt\JmSlideshow\Block\List.php around line number 183 you would see this snap of code

PHP Code:

 if ($listImgs) {
                
$items $listImgs;
                
                for (
$i 0$i count($listImgs); $i++) {
                    
$items[$i] = array();
                    
                    
// minor thumbnail
                    
$items[$i]['thumb'] = '<img src="' Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) . $thumbArray[$i] . '" alt="Photo Thumb" width="' $this->getConfig('thumbImgWidth') . '" height="' $this->getConfig('thumbImgHeight') . '" />';
                    
                    
// main thumbnail
                    
$items[$i]['mainThumb'] = '<img src="' Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) . $mainsThumbs[$i] . '" alt="'.$alts[$i].'" width="' $this->getConfig('mainWidth') . '" height="' $this->getConfig('mainHeight') . '"/>';
                    
                    
// product title and description
                    
$items[$i]['caption'] = $captionsArray[$i];
                }
            } 




you can change it to

PHP Code:

 if ($listImgs) {
                
$items $listImgs;
                
                for (
$i 0$i count($listImgs); $i++) {
                    
$items[$i] = array();
                    
$thumburl Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) . $thumbArray[$i];
                    
$thumburl str_replace(Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB)."media",Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA),$thumburl);
                    
// minor thumbnail
                    
$items[$i]['thumb'] = '<img src="' $thumburl '" alt="Photo Thumb" width="' $this->getConfig('thumbImgWidth') . '" height="' $this->getConfig('thumbImgHeight') . '" />';
                    
$mainthumburl Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) . $mainsThumbs[$i];
                    
$mainthumburl str_replace(Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB)."media",Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA),$mainthumburl);
                    
// main thumbnail
                    
$items[$i]['mainThumb'] = '<img src="' $mainthumburl '" alt="'.$alts[$i].'" width="' $this->getConfig('mainWidth') . '" height="' $this->getConfig('mainHeight') . '"/>';
                    
                    
// product title and description
                    
$items[$i]['caption'] = $captionsArray[$i];
                }
            } 




I hope this change helps

#1

Please login or Register to Submit Answer

Written By

Comments