Magento - Fishpig Wordpress - Featured Image Sizes

I have a Magento installation that integrates with Wordpress using the Fishpig Wordpress module.

As most WP users will know, when you upload an image, Wordpress will create modified versions that refer to the sizes set in the media settings (for example, thumbnail size, medium size and large size). It also creates images for each custom sketch size (e.g. via functions.php).

It seems that the Fishpig Magento module uses only the thumbnail image size.

Unfortunately, I need to be able to display different sizes of the same image (i.e., modified versions of Wordpress) on different pages. For example, a small version will be displayed on the category page, a larger version will be displayed on the message view page.

I was wondering if anyone had experience getting other resized images through this module, since I cannot find a lot of documentation there (or if this is possible with this module, since I also could not see the code that would suggest this functionality).

Thank you for help.

+6
source share
2 answers

I had the same problem ... I wanted to create a recent message widget, and Fishpig has it well documented, but they did not show an example of how to pull out the selected image for the message.

But I found the answer in: /app/design/frontend/base/default/template/wordpress/post/list/renderer/default.phtml :

 <?php if ($featuredImage = $post->getFeaturedImage()): ?> <div class="featured-image left"> <a href="<?php echo $post->getPermalink() ?>" title="<?php echo $this->escapeHtml($post->getPostTitle()) ?>"><img src="<?php echo $featuredImage->getAvailableImage() ?>" alt="<?php echo $this->escapeHtml($post->getPostTitle()) ?>"/></a> </div> <?php endif; ?> 

You can change the "getAvailableImage" to any of them to pull out the different sizes of the images that wordpress produces:

 getThumbnailImage() getMediumImage() getLargeImage() getFullSizeImage() getPostThumbnailImage() getAvailableImage() getImageByType($type = 'thumbnail') 

Hope this helps!

+23
source

Try the code below. and works great for me ..

echo $ featuredImage-> getData ('guid');

0
source

Source: https://habr.com/ru/post/944840/


All Articles