[thelist] Adding to the Login System with Admin Features: Two Questions

Bill Moseley moseley at hank.org
Tue Feb 10 22:55:35 CST 2009


On Tue, Feb 10, 2009 at 09:15:17PM -0600, Tony Spiro wrote:
> 2. I am using this fantastic script as well
> http://dottedi.biz/codesamples/forms/upload/upload_file.php to upload user
> profile pics and I need to know how to resize the image on upload so a
> 3000px wide picture is not crammed into a 50px wide space, causing the load
> time to be slow.

Must be something similar in PHP, but I have this in a Perl
application:

    my $images = Image::Magick->new;

    # Fetch image
    $images->Read( $file );
    my $image = $images->[0] || die 'no image';


    # Resize, strip, and set format
    $image->Resize( '100x100>' );
    $image->Strip;
    $image->Set( magick => 'png' );

In this case I'm saving the image into the database via the $photo
object:

    $photo->image( $i->ImageToBlob );

and save the meta data, too, for serving the image.

    $photo->$_( $i->Get( $_ ) ) for qw/ width height mime /;
    $photo->last_modified( time );




-- 
Bill Moseley
moseley at hank.org
Sent from my iMutt




More information about the thelist mailing list