PHP-GD imagejpeg unable to open

醉酒当歌 提交于 2019-12-06 08:00:22

Where are you running the file from? If it's from the server-side directory then I think you're missing a "../"

Try this:

var_dump(realpath("../../img/thumbs/".$maxWidth."x".$maxHeight."_".$filename));

In

/home/user/workspace/stewart/server-side/

the directory

../../img/thumbs/  

would equate to

 /home/user/workspace/img/thumbs/

so you need

../../../img/thumbs/

A workaround for this is providing the imagejpeg with the full path to the file.

So you can have in config.php something like

define('APPLICATION_PATH',  dirname(__FILE__));

Then in your functions.php call imagejpeg like this:

@imagejpeg($image, APPLICATION_PATH . '/uploads/myfile.jpg', $quality); 
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!