#!/usr/bin/perl use cPanelUserConfig; use lib "$ENV{DOCUMENT_ROOT}/cgi-bin/perlmodules"; use CGI::Carp qw(fatalsToBrowser warningsToBrowser); use Image::Magick; use strict; use warnings; use Boat::config; #use Boat::PhoneImage; #print CGI::header(); ############## This will take a coded phone number, decode it and make it into an inline image ###################### #my $phone = '727-522-3082 ext 1234'; my $SMImageText; my $SPATH = 'fsboat'; my $DOMAIN = 'boatsfsbo.com'; my $query = new CGI($ENV{'QUERY_STRING'}); my $bp = $query->param('bp'); my $ep = $query->param('ep'); my $cp = $query->param('cp'); my $size = $query->param('size'); my $location = $query->param('location'); my $boatlink = $query->param('boatlink'); my $year = $query->param('year'); my $makemodel = $query->param('makemodel'); my $price = $query->param('price'); my $image = $query->param('image'); my $firstname = $query->param('firstname'); my $bigimage; my $smallimage; ### makephoneimage($bp,$ep,$cp,$size,$location,$boatlink,$image,$year,$makemodel,$price,$firstname); ### sub makephoneimage { #use MIME::Base64; $bp = shift; $ep = shift; $cp = shift; $size = shift; $location = shift; $boatlink = shift; $image = shift; $year = shift; $makemodel = shift; $price = shift; $firstname = shift; my $bphone = decode_base64($bp); my $ephone = decode_base64($ep); my $cphone = decode_base64($cp); my @phones; if ($bphone){ push(@phones,$bphone.'\n'); } if ($ephone){ push(@phones,$ephone.'\n'); } if ($cphone){ push(@phones,$cphone); } my $phones = "@phones"; $SMImageText = $phones; if ($size eq 'sm'){ print "Content-type: image/png\n\n"; $smallimage = Image::Magick->new; #$image->Read("/home/florida/public_html/trans.gif"); #$image->Resize(geometry=>'220x25',quality=>100); ############ adjustment for captcha only 4 digits if ($ephone ne 'captcha'){ $smallimage->Set(size => '220x24'); } if ($ephone eq 'captcha'){ $smallimage->Set(size => '50x20'); } ############### #$image->Read('xc:#f7f7f7'); $smallimage->Read('xc:none'); ##makes a transparent canvas #$image->Annotate(text=>$SMImageText,font=>'@/home/'.$SPATH.'/public_html/fonts/Arial.ttf',pointsize=>16,fill=>'#00295a',stroke=>'none',gravity=>'North'); #$imed->Annotate(text=>"BoatsFSBO.com\/$ListingID",x=>1,y=>1,font=>'@/home/fsboblast/public_html/fonts/Arial.ttf',pointsize=>10,stroke=>'#000C',strokewidth=>2,gravity=>'NorthWest'); #$imed->Annotate(text=>"BoatsFSBO.com\/$ListingID",x=>2,y=>2,font=>'@/home/fsboblast/public_html/fonts/Arial.ttf',pointsize=>10,fill=>'#ffffff',stroke=>'none',gravity=>'NorthWest'); $smallimage->Annotate(text=>$SMImageText,x=>1.2,y=>1.2,font=>'@/home/'.$SPATH.'/public_html/fonts/Arial.ttf',pointsize=>20,stroke=>'#404040',strokewidth=>2,gravity=>'North'); $smallimage->Annotate(text=>$SMImageText,x=>1,y=>1,font=>'@/home/'.$SPATH.'/public_html/fonts/Arial.ttf',pointsize=>20,fill=>'#ffffff',stroke=>'none',gravity=>'North'); $smallimage->Strip(); binmode STDOUT; $smallimage->Write('png:-'); } if ($size eq 'big'){ my @mgktitle; ## $boatlink = decode_base64($boatlink); $year = decode_base64($year); $price = decode_base64($price); $makemodel = decode_base64($makemodel); $location = decode_base64($location); $image = decode_base64($image); $firstname = decode_base64($firstname); ## push(@mgktitle,'\n '.$year.'\n'); push(@mgktitle,' '.$makemodel.'\n'); push(@mgktitle,' '.$location.'\n'); push(@mgktitle,' $'.$price.'\n'); ## my $title= "@mgktitle"; my $thumb = Image::Magick->new; $thumb->Read(filename => "$image"); $bigimage = Image::Magick->new; print "Content-type: image/png\n\n"; #$bigimage->Set(size => '420x205'); $bigimage->Read("https://$DOMAIN/images/water.jpg"); ##makes a transparent canvas $bigimage->Resize(geometry=>'420x205!',quality=>100); $bigimage->Annotate(text=>$title,x=>1.2,y=>1.2,font=>'@/home/'.$SPATH.'/public_html/fonts/Arial.ttf',pointsize=>18,stroke=>'#404040',strokewidth=>1.5,gravity=>'West'); $bigimage->Annotate(text=>$title,x=>1,y=>1,font=>'@/home/'.$SPATH.'/public_html/fonts/Arial.ttf',pointsize=>18,fill=>'#f1f1f1',stroke=>'none',gravity=>'West'); $bigimage->Annotate(text=>$boatlink,x=>1.2,y=>1.2,font=>'@/home/'.$SPATH.'/public_html/fonts/Arial.ttf',pointsize=>18,stroke=>'#404040',strokewidth=>2,gravity=>'NorthWest'); $bigimage->Annotate(text=>$boatlink,x=>1,y=>1,font=>'@/home/'.$SPATH.'/public_html/fonts/Arial.ttf',pointsize=>18,fill=>'#ffffff',stroke=>'none',gravity=>'NorthWest'); $bigimage->Annotate(text=>$SMImageText,x=>1.2,y=>1.2,font=>'@/home/'.$SPATH.'/public_html/fonts/Arial.ttf',pointsize=>20,stroke=>'#404040',strokewidth=>2,gravity=>'SouthEast'); $bigimage->Annotate(text=>$SMImageText,x=>1,y=>1,font=>'@/home/'.$SPATH.'/public_html/fonts/Arial.ttf',pointsize=>20,fill=>'#ffffff',stroke=>'none',gravity=>'SouthEast'); $bigimage->Annotate(text=>$firstname,x=>1.2,y=>1.2,font=>'@/home/'.$SPATH.'/public_html/fonts/Arial.ttf',pointsize=>20,stroke=>'#404040',strokewidth=>2,gravity=>'SouthWest'); $bigimage->Annotate(text=>$firstname,x=>1,y=>1,font=>'@/home/'.$SPATH.'/public_html/fonts/Arial.ttf',pointsize=>20,fill=>'#ffffff',stroke=>'none',gravity=>'SouthWest'); $bigimage->Composite(image => $thumb, qw(compose SrcAtop gravity NorthEast)); $bigimage->Strip(); binmode STDOUT; $bigimage->Write('png:-'); } exit; } sub bigcard { my $phone = shift; my $location = shift; my $boatlink = shift; my $title = shift; my $image = shift; print "Content-type: image/png\n\n"; my $SMImageText = $phone; #my $SMImageText ='sdffsdfsdff'; use CGI::Carp qw(fatalsToBrowser warningsToBrowser); use Image::Magick; my $ListingID; my $image = Image::Magick->new; $image->Set(size => '220x50'); $image->Read('xc:#f7f7f7'); $image->Resize(geometry=>'220x50',quality=>100); $image->Annotate(text=>$SMImageText,font=>'@/home/'.$SPATH.'/public_html/fonts/Arial.ttf',pointsize=>14,fill=>'#00295a',stroke=>'none',gravity=>'North'); $image->Strip(); binmode STDOUT; $image->Write('png:-'); #exit; }