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? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.