note 35509 deleted from function.getimagesize by cmb

From: Date: Sun, 18 Dec 2016 09:39:29 +0000
Subject: note 35509 deleted from function.getimagesize by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-208628@lists.php.net to get a copy of this message
Note Submitter: simms ---- here's a nice way of resizing user-uploaded files on the fly, using ImageMagick (on linux), but no GD: <? if( $image_info = getimagesize( "/upload_dir/" . $uploadName ) ) { if( $image_info[ 0 ] > $defaultImgWidth ) { exec( "mogrify -geometry " . $defaultImgWidth . " " . "/upload_dir/" . $uploadName . " &" ); } } ?> $defaultImgWidth would be the target width of the image -- note that the code above resizes the image without distorting its original proportions, and only if it is wider than $defaultImgWidth. the ImageMagick syntax used above ("mogrify ..") overwrites the original file ($uploadName) with the resized image.

« previous php.notes (#208628) next »