Think Visualizer and expand your options
 
Visualizer Navigator 
   Home | Keep up with the news | The Photo FX tour | Photo FX Bookmark and Share

Go Back   Visualizer Forums > Visualizer Online Learning > Web design and Scripting
User Name
Password
Register FAQ Members List Search Today's Posts Mark Forums Read


Reply
 
Thread Tools Search this Thread Display Modes
Old 07-05-2006, 05:37 PM   #1
CaptainKoala
Senior Member
 
CaptainKoala's Avatar
 
Join Date: Feb 2004
Location: land of the foobar
Posts: 381
Send a message via AIM to CaptainKoala Send a message via MSN to CaptainKoala

my photo blog, by CaptainKoala
Default Perl Insanity

I'm trying to write a simple thumbnailing script in Perl that can be run from the command line (or via a pipe), but I don't know perl well enough to deduce what the problem is. I was wondering if perhaps there is a kind, Perl-saavy member out there who could help me. I am running Perl 5.8.0 with GD 2.0.33, libJPEG 6b, and GD.pm 2.34.

My script is this:
Code:
#!/usr/bin/perl -w use GD ; # stuff $type = $ARGV[0]; $srcfile = $ARGV[1]; $destfile = $ARGV[2]; %width = ('low'=>120.00,'med'=>550.00); # open files open(DEST,">$destfile") || die("$!"); # GD stuff $in = newFromJpeg GD::Image($srcfile,1) || die("$!"); # determine target width,height ($srcwidth,$srcheight) = $in->getBounds() || die("$!"); $destheight = int($width{$type} * $srcheight / $srcwidth); $destwidth = $width{$type}; $out = new GD::Image($destwidth,$destheight,1) || die("$!"); # render resize $out->copyResampled($in,0,0,0,0,$destwidth,$destheight,$ srcwidth,$srcheight) || die("$!"); # write to file print DEST $out->jpeg(100); close DEST;


But every time I try to run it, I get this:

Code:
$ ./gdtest.pl low image.jpg thumbnail.jpg Use of uninitialized value in multiplication (*) at gdtest.pl line 19. Use of uninitialized value in subroutine entry at gdtest.pl line 25. Inappropriate ioctl for device at gdtest.pl line 25.


Does anyone have any thoughts?
__________________
#!/usr/bin/env python

import webbrowser

webbrowser.open('http://www.captainkoala.com/')
# general quackery with a point

Last edited by CaptainKoala : 07-05-2006 at 05:43 PM.
CaptainKoala is offline  Live RSS Feed from my photo blog   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump



All times are GMT. The time now is 03:26 AM.



Copyright © 2002-2006 Visualizer Image Group.