i am trying to get images of a pdf file. but the problem is that my code produce error for some pdf files. probably file size problem
this is my code
$saved_file_location = "images.pdf";
$destination_dir = "t";
$Name = "123";
exec('convert -verbose -density 150 '.$saved_file_location.' -crop 1020x490+128+40 -quality 90 '.$destination_dir."/".$Name.'-%03d.jpg');
sleep(5);
//echo filesize($destination_dir."/".$Name.'-000.jpg'). "<br>";
if(filesize($destination_dir."/".$Name.'-000.jpg') < 10000)
{
exec('convert -verbose -density 150 '.$saved_file_location.' -crop 1020x490+128+580 -quality 90 '.$destination_dir."/".$Name.'-%03d.jpg');
sleep(5);
//echo filesize($destination_dir."/".$Name.'-001.jpg')."<br>";
if(filesize($destination_dir."/".$Name.'-001.jpg') < 10000)
{
exec('convert -verbose -density 150 '.$saved_file_location.' -crop 1020x490+128+1125 -quality 90 '.$destination_dir."/".$Name.'-%03d.jpg');
}
}
and this error i get
PHP Warning: filesize(): stat failed for t/123-000.jpg in /home3/domain/pdf_to_images.php on line 10
some time the code work fine and produce multiple images of pdf file but some time i get this error
filesize("ThisFileDoesntExist.txt");- it gives the same error message. Either the file you're trying to read the size of doesn't exist or you don't have access to it.