Go Back   Velocity Reviews > Newsgroups > PERL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

PERL - open()ing strings as filehandles

 
Thread Tools Search this Thread
Old 07-15-2009, 09:16 PM   #1
Default open()ing strings as filehandles


Hello all,

I'm trying to use ImageMagick to create a thumbnail from an image (JPEG) that I
have as a string returned from an SQL query. Image::Magick->Read() will accept
either a filename or an open file handle, so I'm opening the string as and
passing it a reference (?) to it.

my $immk = Image::Magick->new();

open(FH, "<", \$image);
$immk->Read(file => \*FH);
close(FH);

$immk->Thumbnail(width => THUMBNAIL_WIDTH);

open(FH, ">", \$image);
$immk->Write(file => \*FH, filename => 'image.jpg');
close(FH);

When I'm done, I expect to have the thumbnailed image in $image, but I have
NULL! If I try this with real files, everything works fine:

my $immk = Image::Magick->new();
$immk->Read('/tmp/01.jpg');
$immk->Thumbnail(width => THUMBNAIL_WIDTH);
$immk->Write('/tmp/thumbnailed.jpg');

I really have no clue what I'm doing wrong. Thoughts, anyone?

Thanks.



J. Sharp
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Website Not Opening! mansi online Hardware 0 05-31-2009 03:07 PM
Error opening and uplodaing files containing letters such as ä, ö etc. Chayanne Software 3 07-03-2007 06:05 AM
File download dialog box is coming while opening the document using Servlet aarthi Software 0 04-24-2007 03:20 PM
OLYMPIC GAMES ATHENS 2004 Opening Ceremony 2 DVDs, Closing Ceremony 2 DVDs, and EURO 2004 ( 6 DVDs ) , THE MATCHES OF THE GREEK NATIONAL FOOTBALL TEAM, DURING THE PANEUROPEAN FOOTBALL CHAMPIONSHIPS 'EURO 2004' IN THE FOOTBALL STADIUMS IN PORTUGAL, W Zorba.GR DVD Video 0 10-29-2004 05:45 PM
OLYMPIC GAMES ATHENS 2004 Opening Ceremony 2 DVDs, Closing Ceremony 2 DVDs, eldorado DVD Video 2 10-27-2004 01:12 AM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46