sub read_image_file { my $fh = shift; # filename/file handle my $img = new Image::Magick; my ($full, $thumb, $err); # read full-size image directly from upload file (read ($fh, $full, -s $fh) == -s $fh) or error ("Can't read image file: $!"); # produce jpg from pdf (this is where i'm lost because i get a can't convert error) # produce thumbnail from full-size image $err = $img->BlobToImage ($full); error ("Can't convert image data: $err") if $err; $err = $img->Scale (geometry => "150x194"); error ("Can't scale image file: $err") if $err; $thumb = $img->ImageToBlob (); return ($full, $thumb); }