note 41719 added to function.imagecopyresized

From: Date: Tue, 20 Apr 2004 23:39:21 +0000
Subject: note 41719 added to function.imagecopyresized
Groups: php.notes 
Request: Send a blank email to php-notes+get-68393@lists.php.net to get a copy of this message
I recently had to go back and take a look at creating a thumbnail from an uploaded image in a fairly restricted hosting environment. I created the below as a butt-easy example of how to do that. Thinking it was fairly newbie friendly, I’m posting it here… For newbies: Create a directory with full read, write and exec permissions. Upload the below file and a 200x200 jpeg called “girl.jpg” to that directory. Then hit the script in a browser. I’ve used as few variables as possible, so lookup individual functions for their usage. Kapla! <?php error_reporting (E_ALL); $abc = imagecreatefromjpeg("girl.jpg"); $def = imagecreate(20, 20); imagecopyresized($def, $abc, 0, 0, 0, 0, 20, 20, 200, 200); imagejpeg($def, 'new_girl_thumb.jpg', 95); ImageDestroy($abc); ImageDestroy($def); print "<HTML><HEAD><TITLE>test</TITLE></HEAD><BODY> original:<hr><img src=\"girl.jpg\"><br><br><br>new:<hr><img src=\"new_girl_thumb.jpg\"></BODY></HTML>"; ?> ---- Manual Page -- http://www.php.net/manual/en/function.imagecopyresized.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+41719 Delete -- http://master.php.net/manage/user-notes.php?action=delete+41719&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+41719&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#68393) next »