Professional Web Applications Themes

Image Magick - PHP Development

Removed by Administrator...

  1. Moderated Post

    Default Re: Image Magick

    Removed by Administrator
    Kae Verens Guest
    Moderated Post

  2. #2

    Default Image Magick

    Hello all,

    I am trying to use Image::Magick to resize a JPEG. This routine works to
    display the full size image from a blob in my Firebird database:

    while ( my ($PixData )
    = $sth->fetchrow ) {
    print header('image/jpeg');
    print $PixData;
    }

    But when I add the Image::Magick stuff:

    while ( my (PixData) = $sth->fetchrow) {
    my $PixDisp=Image::Magick->new(magick=>'jpg');
    $PixDisp->BlobToImage(PixData);
    $PixDisp->Resize(geometry=>'160x120');
    print header('image/jpeg');
    print $PixDisp;
    }

    I get this:
    Image::Magick=ARRAY(0x82fdee8)
    instead of an image. Can anyone see my obvious mistake?

    Cheers.

    Scott.

    Scott Taylor Guest

  3. #3

    Default Re: Image Magick


    > Hello all,
    >
    > I am trying to use Image::Magick to resize a JPEG. This routine works to
    > display the full size image from a blob in my Firebird database:
    >
    > while ( my ($PixData )
    > = $sth->fetchrow ) {
    > print header('image/jpeg');
    > print $PixData;
    > }
    >
    > But when I add the Image::Magick stuff:
    >
    > while ( my (PixData) = $sth->fetchrow) {
    > my $PixDisp=Image::Magick->new(magick=>'jpg');
    > $PixDisp->BlobToImage(PixData);
    > $PixDisp->Resize(geometry=>'160x120');
    > print header('image/jpeg');
    > print $PixDisp;
    > }
    >
    > I get this:
    > Image::Magick=ARRAY(0x82fdee8)
    > instead of an image. Can anyone see my obvious mistake?
    >
    You are getting this because $PixDisp holds an Image::Magick object
    which can't be stringified as you desire. You need to (it appears) call
    the 'Write' method of the object to have it converted to image data.

    [url]http://www.ImageMagick.org/www/perl.html[/url]

    Check the above for an example of how to print an image to a filehandle,
    in your case you want the default STDOUT....

    HTH,

    [url]http://danconia.org[/url]
    Wiggins D Anconia Guest

  4. #4

    Default Re: Image Magick

    At 10:28 AM 01/09/2004, Wiggins d Anconia wrote:

    > > Hello all,
    > >
    > > I am trying to use Image::Magick to resize a JPEG. This routine works to
    > > display the full size image from a blob in my Firebird database:
    > >
    > > while ( my ($PixData )
    > > = $sth->fetchrow ) {
    > > print header('image/jpeg');
    > > print $PixData;
    > > }
    > >
    > > But when I add the Image::Magick stuff:
    > >
    > > while ( my (PixData) = $sth->fetchrow) {
    > > my $PixDisp=Image::Magick->new(magick=>'jpg');
    > > $PixDisp->BlobToImage(PixData);
    > > $PixDisp->Resize(geometry=>'160x120');
    > > print header('image/jpeg');
    > > print $PixDisp;
    > > }
    > >
    > > I get this:
    > > Image::Magick=ARRAY(0x82fdee8)
    > > instead of an image. Can anyone see my obvious mistake?
    > >
    >
    >You are getting this because $PixDisp holds an Image::Magick object
    >which can't be stringified as you desire.
    D'oh! I C
    >You need to (it appears) call the 'Write' method of the object to have it
    >converted to image data.
    OK
    >[url]http://www.ImageMagick.org/www/perl.html[/url]
    >
    >Check the above for an example of how to print an image to a filehandle,
    >in your case you want the default STDOUT....
    I've been all over that page, but I'm still stuck at how to do what I
    want. I don't want Apache writing files, I just want to display the new
    image dynamically. Is that even possible?


    Scott Taylor Guest

  5. #5

    Default Re: Image Magick

    At 11:02 AM 01/09/2004, Scott Taylor wrote:
    >At 10:28 AM 01/09/2004, Wiggins d Anconia wrote:
    >
    >
    >
    >>[url]http://www.ImageMagick.org/www/perl.html[/url]
    >>
    >>Check the above for an example of how to print an image to a filehandle,
    >>in your case you want the default STDOUT....
    >
    >I've been all over that page, but I'm still stuck at how to do what I
    >want. I don't want Apache writing files, I just want to display the new
    >image dynamically. Is that even possible?

    Ah, silly me. Thanks Wiggins.

    while ( my (PixData) = $sth->fetchrow) {
    my $PixDisp=Image::Magick->new(magick=>'jpg');
    $PixDisp->BlobToImage(PixData);
    $PixDisp->Resize(geometry=>'160x120');
    print header('image/jpeg');
    binmode STDOUT;
    $PixDisp->Write('jpg:-');


    Scott Taylor Guest

Similar Threads

  1. Image::Magick newbie
    By Ananth Chellappa in forum PERL Modules
    Replies: 0
    Last Post: September 6th, 02:19 AM
  2. Image magick palette
    By kkarma in forum PERL Modules
    Replies: 0
    Last Post: July 31st, 03:16 AM
  3. Image::Magick and padding of image
    By Lars Haugseth in forum PERL Modules
    Replies: 0
    Last Post: February 5th, 07:17 PM
  4. Image::Magick and Tk::Photo
    By Eric McDaniel in forum PERL Modules
    Replies: 2
    Last Post: September 20th, 08:01 PM
  5. [PHP] Image Magick
    By David T-G in forum PHP Development
    Replies: 0
    Last Post: August 26th, 10:42 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139