Warning: Cannot modify header information - headers already sent by (output started at /www/wwwroot/sbboke.com/wp-content/plugins/wordpress-seo/src/integrations/front-end-integration.php:409) in /www/wwwroot/sbboke.com/wp-content/themes/pacify/content-single.php on line 5

Magento:旋转图像

这是在Magento中将图像旋转到您选择的任何程度的快速提示。Varien_Imagerotate函数起到了神奇的作用:)

代码如下:

$mainImage = Mage::getBaseDir('media') . DS . 'test' . DS . 'image.jpg';
 
$image = new Varien_Image($mainImage);
 
// rotate image with the angle of your choice
// rotate($angle)
$image->rotate(90);
 
// save the image
$image->save(Mage::getBaseDir('media'). DS . 'test' . DS . 'new.jpg');

代码说明

在上面的代码中,您可以看到在media / test /目录中有一个名为image.jpg的图像。 然后我将图像旋转到90度。 新的旋转图像保存在media / test /目录中,作为new.jpg

希望这可以帮助。谢谢。

相关文章

0 0 投票数
文章评分
订阅评论
提醒
0 评论
内联反馈
查看所有评论