Using -path and creating multiple images
Posted: 2011-05-18T08:15:30-07:00
Hi guys,
Currently I'm using ImageMagick to convert PDF's into jpegs with the aim of creating 2 jpegs on the fly, 1 a regular sized jpeg and 1 a thumbnail.
Here's where I am currently. This code below successfully creates jpegs of all the pages in the pdf ($targetFile) and renames them with the jpeg extension. Instead of saving those outputted files in the same directory I'd like to put them in an already created directory within the working directory called "thumbs".
This creates one jpeg of each page in the pdf and saves it correctly beside the PDF. I want it saved in a subdirectory, I've tried using "-path" as per the manual but it has no effect in my use, and there's no example! That's the first step!
The next step is to get it to create 2 jpegs on the fly, one large one small, saving the large ones alongside the PDF and the small in "thumbs" directory.
Can anyone help please? I'm relatively familiar with PHP and I'm pretty sure this an ImageMagick "problem" more so than PHP as it's working, just not going where I want it!
Cheers.
Currently I'm using ImageMagick to convert PDF's into jpegs with the aim of creating 2 jpegs on the fly, 1 a regular sized jpeg and 1 a thumbnail.
Here's where I am currently. This code below successfully creates jpegs of all the pages in the pdf ($targetFile) and renames them with the jpeg extension. Instead of saving those outputted files in the same directory I'd like to put them in an already created directory within the working directory called "thumbs".
Code: Select all
$image = exec("convert " . $targetFile . " " . substr_replace($targetFile , 'jpg', strrpos($targetFile , '.') +1));
The next step is to get it to create 2 jpegs on the fly, one large one small, saving the large ones alongside the PDF and the small in "thumbs" directory.
Can anyone help please? I'm relatively familiar with PHP and I'm pretty sure this an ImageMagick "problem" more so than PHP as it's working, just not going where I want it!
Cheers.