简体   繁体   English

Magento-调整图片大小的网站

[英]Magento - Resize image breaking site

For some reason the site breaks when it tries to do this: 由于某些原因,站点在尝试执行此操作时会中断:

<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(242) ?>

The site renders until that line, no errors are shown anywhere (neither apache error or log, nor system.log or exception.log). 该站点将一直渲染到该行,在任何地方都不会显示任何错误(既不是Apache错误或日志,也不是system.log或exception.log)。

It happens on any website of this project, I don't know if I'm missing some PHP module or something like that? 它发生在该项目的任何网站上,我不知道我是否缺少一些PHP模块或类似的东西? On dev site it works well with the same code, so I'm not sure what could be causing it. 在开发站点上,使用相同的代码可以很好地工作,因此我不确定是什么原因引起的。 Other projects are working well too. 其他项目也运作良好。

If you're not seeing any errors in the Magento logs, this might be a symptom of not having PHP's GD extension enabled. 如果您未在Magento日志中看到任何错误,则可能是未启用PHP的GD扩展的症状。 I believe the resize() function uses that extension. 我相信resize()函数使用该扩展名。

Check your php configuration to make sure that's enabled. 检查您的php配置,以确保已启用。

Here are the other system requirements, assuming you're using a version of Magento pre-1.9: system requirements 假设您使用的是Magento 1.9之前的版本,这是其他系统要求: 系统要求

I fixed this installing php-gd module 我修复了此安装php-gd模块

sudo apt-get install php5-gd

Then 然后

sudo service apache2 restart

It fixed the problem 它解决了问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM