http://www.perlmonks.org?node_id=802348


in reply to Imager - Problem with Filehandle (Catalyst, DBIx::Class::InflateColumn::FS)

For medium_pfad and thumb_pfad you appear to be supplying Imager objects to something expecting file handles. That can't work.

For the original file, when you read the file via a fh into an Imager image, Imager will read to the end of the image, so unless you seek back to the beginning, only the remnant of the file will be copied (usually nothing) to the file referenced by original.

Fixing this for original is simple enough, just seek back to the beginning of the file.

For medium_pfad and thumb_pfad you could write the images to scalars ($im->write(data => \$data, ...)) and open those using open my $fh, \$data to provide a file handle to D::C::IC:FS)

# something like this my $medium_data; # write to an in-memory file requires a file format $medium->write(type => "png", data => \$data) or die; open my $medium_fh, "<", \$data or die; $self->form->item->medium_pfad($medium_fh);