Hello all. Im a Java developer, but have been given the extra title of Perl developer also. So im new to the code structure. Basically Im trying to pull the width and height from a url example below and display in an error msg just to test:
http://...readimage?1234a&height=10&width=10
use strict;
use warnings;
use CGI::Carp qw(fatalsToBrowser);
use CGI::Fast qw(:standard);
use LWP::UserAgent;
use Sys::Hostname;
use File::stat;
use Date::Format;
use Image::Magick;
### Image Path Hash Module
require "/web/images/perl/hash.pm";
my $image_path = '/web/images';
my $image_path_old = '/web/imgsrv';
my $ecode;
my %GET = ();
my $width;
my $height;
while ( my $cgi = new CGI::Fast ) {
%GET = $cgi->Vars();
if ( $GET{'keywords'} || $GET{'width'} || $GET{'height'} ) { # Data was included, attempt to process (stops bare readimage calls)
my $external_id;
$width = $GET{'width'};
$height = $GET{'height'};
$external_id = $GET{'keywords'};
if ( $ENV{'PATH_INFO'} ) { # Called via / (PATH_INFO will contain either a URL or an external ID)
if ( $ENV{'PATH_INFO'} =~ /\/http:\// ) { # This is a separate logic branch for image URLs (Note the single slash in the RE--double slashes are int$
if ( $ENV{'PATH_INFO'} !~ /\.exe$/ ) { # This will prevent URLs with .exe extensions from being processed
if ( $ecode = run_url('http://' . substr($ENV{'PATH_INFO'}, 7), $cgi) ) { # substr() fixes the double/single slash problem caused by the HTTP$
error($cgi, "URL processing failed, error number $ecode");
}
next();
} else {
error($cgi, 'Invalid URL (.exe detected)');
next();
}
}
error($cgi, 'Valid External test1 ID …