CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
ImageMagick Question

 



kruzer
Deleted

Jun 19, 2000, 8:29 AM

Post #1 of 1 (837 views)
ImageMagick Question Can't Post

Has anyone ever had problems or figured out a solution to wrapping text of a image string ontop of another image(background image)?

Here's my beginning code

use DBI;
use URI::URL;
use HTTP::Status;
use Getopt::Long;
use FileHandle;
use URI::Escape;
use CGI qw(-any);
use Image::Magick;
use Text::Wrapper;
use POSIX qw(floor);

...addional code


sub CreateBanner
{
my ($cprod_id, $bgcolor, $bgimage, $adsize, $company, $company_color, $company_size, $slogan, $text_color, $text_size, $phone, $phone_color, $phone_size, $company_font,$text_font, $phone_font) = @_;
$filename = "/domains/apache_tmp/images/".$cprod_id."_sbta.gif";
# $filename = "/domains/apache_tmp/images/".$cprod_id."_sbta.jpeg";
# $bgimg = "/domains/apache_tmp/images/$bgimage";
$company_font_file = "/usr/openwin/lib/X11/fonts/TrueType/".$company_font.".ttf";
$text_font_file = "/usr/openwin/lib/X11/fonts/TrueType/".$text_font.".ttf";
$phone_font_file = "/usr/openwin/lib/X11/fonts/TrueType/".$phone_font.".ttf";
if (-e $company_font_file) {
} else {
$company_font = "Arial";
}
if (-e $text_font_file) {
} else {
$text_font = "Arial";
}
if (-e $phone_font_file) {
} else {
$phone_font = "Arial";
}
$company_font = "@/usr/openwin/lib/X11/fonts/TrueType/".$company_font.".ttf";
$text_font = "@/usr/openwin/lib/X11/fonts/TrueType/".$text_font.".ttf";
$phone_font = "@/usr/openwin/lib/X11/fonts/TrueType/".$phone_font.".ttf";
# $str = $cprod_id.$bgcolor.$bgimage.$adsize.$company.$company_color.$company_size.$slogan.$text_color.$text_size.$phone.$phone_color.$phone_size.$company_font.$text_font.$phone_font.$filen ame;
# &check_data($str);
$image = Image::Magick->new;
$image->Set(size=>"$adsize");
$image->Quantize(colorspace=>'RGB');
$image->Get('base_columns');


#added text wrapper - my attempt
# require Text::Wrapper;
# $wrapper = $wrapper = Text::Wrapper->new(, body_start => ' ');
# print $wrapper->wrap($company);

$Text::Wrap::columns = POSIX::floor(125/10);

$x = $image->ReadImage("xc:$bgcolor");
# $x = $image->ReadImage("$bgimg");
warn "$x" if "$x";
$image->Annotate(font=>$company_font, text=>$company, pen=>$company_color, gravity=>'North', 'y'=>'2', pointsize=>$company_size);
$image->Annotate(font=>$text_font, text=>$slogan, pen=>$text_color, gravity=>'Center', pointsize=>$text_size);
$image->Annotate(font=>$phone_font, text=>$phone, pen=>$phone_color, gravity=>'South', 'y'=>'2', pointsize=>$phone_size);
$x = $image->Write(filename=>$filename, compress=>'LZW');
warn "$x" if "$x";
undef $image;
}

Thanks
Dano

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives