Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Resize and cache images of my own
 
Commanderbob
Member
 
Total Posts:  61
Joined:  2008-10-19
 

I need to resize and have magento cache images that I added to the site. I am making the titles in the side nav bar images.

In many files I see this done with something like

$this->helper('catalog/image')->init($this->getProduct(), 'thumbnail'$_image->getFile())->resize(7070)
How can I use that to resize and cache my own images?
 
Magento Community Magento Community
Magento Community
Magento Community
 
magedev
Sr. Member
 
Avatar
Total Posts:  117
Joined:  2009-06-01
 

You can perform basic image operation using Varien_Image class.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Commanderbob
Member
 
Total Posts:  61
Joined:  2008-10-19
 

What do you mean by that? Could you give me an example?
Thanks,
Justin

 
Magento Community Magento Community
Magento Community
Magento Community
 
magedev
Sr. Member
 
Avatar
Total Posts:  117
Joined:  2009-06-01
 

I placed example of basic usage on my blog. Please let me know if you have any problems with the code.

 
Magento Community Magento Community
Magento Community
Magento Community
 
eliezerisrael
Jr. Member
 
Total Posts:  28
Joined:  2009-06-18
 

I’m interested in the same thing.

The Vairen class helps with the resizing, but doesn’t appear to help with the caching.
Would be nice if we could use the built in product resize() method, with its caching, on other images as well.

I’m trying to create a dummy product in order to do this, but it’s not quite working for me. 

<?php $_tempProduct Mage::getSingleton('catalog/product'?>
<img width="400" height="100" src="<?php echo $this->helper('catalog/image')->init($_tempProduct, 'image', 'path_to_image')->resize(400,100) ?>" alt="seller_logo" />

The image just comes up as the Magento placeholder.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top