dousha7904 2015-07-24 05:21
浏览 69

Imagemagick复合覆盖文件

Good day. I am new to Imagemagick, and I just wanna ask what's wrong with this code

$cmd_for_wm = "composite -gravity southeast watermark.png image.jpg image.jpg;";    
exec($cmd_for_wm);

When I run it in the terminal, it is working well, but when I incorporated it in PHP, it doesn't work. Why?

Thanks for you in advance :) Cheers

  • 写回答

1条回答 默认 最新

  • doucitan2544 2015-07-24 07:34
    关注

    I've tried your example and it does "die" silently.
    This, on the other hand seems to work:

    $cmd_for_wm = "composite -gravity southeast watermark.png image.jpg image.jpg;";    
    passthru($cmd_for_wm);
    

    Very curious indeed. Since the main difference between exec and passthru is the output handling. The later is used for binary data.

    My take on this is that passthru correctly allows composite to output the processed image (which is binary data) into the specified file.

    For a detailed explanation, please see PHP - exec() vs system() vs passthru()

    评论

报告相同问题?

悬赏问题

  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程