Magento - Fishpig Wordpress - 特色图片大小

lee*_*lee 7 wordpress magento fishpig

我安装了Magento,它使用Fishpig Wordpress模块​​与Wordpress集成.

正如大多数WP用户所知,在上传图像时,Wordpress将创建引用媒体设置中设置的尺寸的调整大小的版本(例如缩略图大小,中等大小和大尺寸).它还为您指定的每个自定义缩略图大小创建图像(例如,通过functions.php).

似乎Fishpig Magento模块仅使用缩略图图像大小.

不幸的是,我需要能够在不同的页面上显示相同图像的不同大小(即Wordpress创建的已调整大小的版本).例如,类别页面将显示小版本,后视图页面将显示更大的版本.

我想知道是否有人有任何经验通过这个模块检索其他调整大小的图像,因为我找不到很多文档(或者甚至可能使用此模块,因为我也看不到任何建议此功能的代码).

非常感谢帮助.

Tra*_*man 25

我有同样的问题...我想创建一个最近的帖子小部件和Fishpig有很好的记录,但他们没有显示如何拉出帖子的特色图像的例子.

但我找到了答案/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; ?>
Run Code Online (Sandbox Code Playgroud)

您可以将"getAvailableImage"更改为其中任何一个,以拉出wordpress生成的不同图像大小:

getThumbnailImage()
getMediumImage()
getLargeImage()
getFullSizeImage()
getPostThumbnailImage()
getAvailableImage()
getImageByType($type = 'thumbnail')
Run Code Online (Sandbox Code Playgroud)

希望这可以帮助!