Scooby08 Posted November 5, 2008 Share Posted November 5, 2008 I'm trying to create a thumbnail of just the first page of a pdf and have been unsuccessful.. Here is the code that works perfectly, but creates thumbnails for all pages.. <?php $new_file_name = preg_replace("/[^a-z0-9\.]/i",'_',$_FILES['uploaded_image']['name']); exec("/usr/local/bin/convert \"".$_FILES['uploaded_image']['tmp_name']."\" -colorspace RGB $supplied_dir/". $new_file_name . ""); $patterns = array ('/[^a-z0-9\.]/i','/pdf/','/PDF/'); $replace = array ('_','jpg','jpg'); $new_file_name_image = preg_replace($patterns,$replace,$_FILES['uploaded_image']['name']); exec("/usr/local/bin/convert $supplied_dir/$new_file_name -thumbnail '150x150' $supplied_dir/.thumbs/viewer_150x150_$new_file_name_image"); ?> I read that I can add a zero in brackets somewhere after the pdf file, but this doesn't seem to work.. <?php exec("/usr/local/bin/convert $supplied_dir/$new_file_name[0] -thumbnail '150x150' $supplied_dir/.thumbs/viewer_150x150_$new_file_name_image"); ?> What am I missing here? Link to comment https://forums.phpfreaks.com/topic/131557-pdf-thumbnail-of-first-page/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.