开发者

How can i get the name of resulting converted images from a pdf using php imagemagick?

开发者 https://www.devze.com 2023-04-13 06:42 出处:网络
开发者_Go百科Im converting some pdfs to pngs wth exec(\"convert readme.pdf readme.png\") And then i need to store in a mysql database the resulting image filenames from any given pdf.
开发者_Go百科

Im converting some pdfs to pngs wth

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

And then i need to store in a mysql database the resulting image filenames from any given pdf.

This is because when i convert in this manner and the source pdfs are more than one page i get a series of: readme-0.png readme-1.png readme-2.png

So the question is: how can i determine after conversion the resulting image filenames?

Thanks in advance, hope i made myself clear.


It'll always be originalname-#.png for multi-page conversions.

$input = "readme.pdf";
$basename = basename($input, '.pdf');

$images = glob("{$basename}-*.png");
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号