【问题标题】:How can i get the name of resulting converted images from a pdf using php imagemagick?如何使用 php imagemagick 从 pdf 中获取转换后的图像的名称?
【发布时间】:2011-10-14 17:53:29
【问题描述】:

我正在将一些 pdf 转换为 png

exec("convert readme.pdf readme.png")

然后我需要将来自任何给定 pdf 的结果图像文件名存储在 mysql 数据库中。

这是因为当我以这种方式转换并且源 pdf 文件不止一页时,我会得到一系列:readme-0.png readme-1.png readme-2.png

所以问题是:如何确定转换后的图像文件名?

先谢谢了,希望我说清楚了。

【问题讨论】:

    标签: php imagemagick image-conversion


    【解决方案1】:

    对于多页转换,它始终是 originalname-#.png。

    $input = "readme.pdf";
    $basename = basename($input, '.pdf');
    
    $images = glob("{$basename}-*.png");
    

    【讨论】:

      猜你喜欢
      • 2018-10-10
      • 2014-01-02
      • 2015-03-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多