# main.pm ... my $client_id = "73737"; my $get_image = thumbs::get_thumbs($client_id); $content .= ""; return $content; } ... # thumbs.pm package thumbs; use strict; use CGI::Carp qw(fatalsToBrowser); use CGI; sub get_thumbs { my $client_id = shift; my $q = new CGI; my $path = "/opt/www/images/"; my $file = "/img_1.png"; my $image = $path ."". $client_id ."". $file; print $q->header(-type => 'image/png'); open IMAGE, $image or die "Cannot open $image $!\n"; binmode STDOUT; print ; close IMAGE; return; } 1;