1

I have a question regarding the php file structure.

I want to run a script to genearte images of bunch of pdf files.

My problem is the actually pdf files are in different folders and structures.

For example:

a pdf could locate in

/test/book/pdf/test.pdf.

another one could be in

/server/pdfs/link/dummy.pdf.

There are thousands of pdfs file in the file system and I am using Imagick to generate the images from pdfs.

I am not sure how to locate all of the pdf nor how to specify the file path in imagick constructor.

 $im = new imagick('file path to pdf here');  //I don't know how to specify the file path here...
 $im->setImageFormat( "jpg" );

Can anyone gives me a hint? Thanks so much!

FlyingCat
  • 14,036
  • 36
  • 119
  • 198

1 Answers1

1

You could go up to the root folder and scan all the directories and their subdirectories for .pdf files and store them in an array (PHP: scandir), an array or a string with a caracter-delimiter between each filename.