User Contrib Notes for manual
| From: | Alex Harradine | Date: | Thu, 31 Jul 2003 01:21:29 +0000 |
| Subject: | User Contrib Notes for manual | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-19661@lists.php.net to get a copy of this message | ||
Trying to add a user contrib note to function imagecopyresampled and it
keeps coming back with
Your note contains a bit of text that will result in a line that is too
long, even after using wordwrap().
Attached is the text i am trying to post
__ __ __ __ __ __ __ __ __ __ __ __ __
Alex Harradine
Internet Co-Ordinator Sky Channel
Internet Co-Ordinator 2KY
Crystal Reports Writer
Sky Channel
Phone:
Direct:
Email: +61 2 94510888
+61 2 99750348
aharradine@skychannel.com.au <mailto:aharradine@skychannel.com.au>
79 Frenchs Forest Road
Frenchs Forest, Sydney NSW 2086
Visit our website www.skychannel.com.au <http://www.skychannel.com.au/>
"This message and any attachment to it is intended for the use of the
individual or entity to whom it is addressed by the first sender and
contains information which may be confidential and/or privileged.
If you receive this message and any attachment in error, please delete it
immediately and notify the sender by electronic mail or telephone (61 2)
9451 0888. Unless you have been expressly authorised by the sender, you are
prohibited from copying, distributing or using the information contained in
this message and any attachment.
Sky Channel (ABN 77 009 136 010) is a part of the Tab Limited Group. Sky
Channel is not responsible for any changes made to this message or any
attachment other than those made by Sky Channel, or for the effect of
changes made by others on the meaning of this message and any attachment.
Sky Channel does not represent that any attachment is free from computer
viruses or defects and the user assumes all responsibility for any loss,
damage or consequence resulting directly or indirectly from the use of any
attachment."
On my page, an admin would upload an image of any size into mysql. On page display This script resizes the image to a max of 80 x 100 and creates a .jpg thumbnail if 1 does not already exist. The images were reduced from 200KB to 3KB with very good image quality. $query=mysql_query("select playerprofile.teamid, playerprofile.name, playerprofile.position, playerprofile.nickname, playerprofile.favteam, playerprofile.despiseteam, playerprofile.sportsman, playerprofile.favourite, playerprofile.embarrasing, playerprofile.themesong, playerprofile.guest1, playerprofile.guest2, playerprofile.guest3, teams.name, playerprofile.filename FROM playerprofile, teams WHERE playerprofile.teamid=teams.id and playerprofile.id=$id")or die(mysql_error()); $get=mysql_fetch_row($query); $teamid=$get[0]; $name=$get[1]; $position=$get[2]; $nickname=$get[3]; $favteam=$get[4]; $despiseteam=$get[5]; $sportsman=$get[6]; $favourite=$get[7]; $embarrasing=$get[8]; $themesong=$get[9]; $guest1=$get[10]; $guest2=$get[11]; $guest3=$get[12]; $teamname=$get[13]; $filename=$get[14]; $extension=strtolower(strstr"$filename", ".")); if(!$filename=="") { $imagehw = GetImageSize("http://www.chatswoodrangers.com.au/teams/getpic.php?id=$id"); $imagewidth = $imagehw[0]; $imageheight = $imagehw[1]; //get new sizes to make images max of 80 x 100 and in //proportion if($imagewidth > 80) { $percent=80/$imagewidth; $imagewidth=80; $imageheight=$percent * $imageheight; } if($imageheight > 100) { $percent=100/$imageheight; $imageheight=100; $imagewidth=$percent * $imagewidth; } //now resize and create thumbnail. Use the outputed //thumbnail for display. Keep the original large file in database //detect if thumbnail has already been created. If yes then //just go to display, no need to do routine again if(!file_exists('/home/nve0s/public_html/chatswoodrangers/img/profiles/$id.jpg')) { if($extension==".jpg" or $extension==".jpeg") { $src_img = imagecreatefromjpeg("http://www.chatswoodrangers.com.au/teams/getpic.php?id=$id"); } else if($extension==".gif") { $src_img = imagecreatefromgif("http://www.chatswoodrangers.com.au/teams/getpic.php?id=$id"); } else if($extension==".bmp") { $src_img = imagecreatefromwbmp("http://www.chatswoodrangers.com.au/teams/getpic.php?id=$id"); } $dstimage = imagecreatetruecolor($imagewidth, $imageheight); imagecopyresampled ($dstimage, $src_img, 0, 0, 0, 0, $imagewidth, $imageheight, $imagehw[0], $imagehw[1]); imagejpeg ($dstimage, "/home/nve0s/public_html/chatswoodrangers/img/profiles/$id.jpg", 75); ImageDestroy($src_img); ImageDestroy($dstimage); } echo "<img src='/img/profiles/$id.jpg' border='0'>"; }
On my page, an admin would upload an image of any size into mysql. On page display This script resizes the image to a max of 80 x 100 and creates a .jpg thumbnail if 1 does not already exist. The images were reduced from 200KB to 3KB with very good image quality. $query=mysql_query("select playerprofile.teamid, playerprofile.name, playerprofile.position, playerprofile.nickname, playerprofile.favteam, playerprofile.despiseteam, playerprofile.sportsman, playerprofile.favourite, playerprofile.embarrasing, playerprofile.themesong, playerprofile.guest1, playerprofile.guest2, playerprofile.guest3, teams.name, playerprofile.filename FROM playerprofile, teams WHERE playerprofile.teamid=teams.id and playerprofile.id=$id")or die(mysql_error()); $get=mysql_fetch_row($query); $teamid=$get[0]; $name=$get[1]; $position=$get[2]; $nickname=$get[3]; $favteam=$get[4]; $despiseteam=$get[5]; $sportsman=$get[6]; $favourite=$get[7]; $embarrasing=$get[8]; $themesong=$get[9]; $guest1=$get[10]; $guest2=$get[11]; $guest3=$get[12]; $teamname=$get[13]; $filename=$get[14]; $extension=strtolower(strstr"$filename", ".")); if(!$filename=="") { $imagehw = GetImageSize("http://www.chatswoodrangers.com.au/teams/getpic.php?id=$id"); $imagewidth = $imagehw[0]; $imageheight = $imagehw[1]; //get new sizes to make images max of 80 x 100 and in //proportion if($imagewidth > 80) { $percent=80/$imagewidth; $imagewidth=80; $imageheight=$percent * $imageheight; } if($imageheight > 100) { $percent=100/$imageheight; $imageheight=100; $imagewidth=$percent * $imagewidth; } //now resize and create thumbnail. Use the outputed //thumbnail for display. Keep the original large file in database //detect if thumbnail has already been created. If yes then //just go to display, no need to do routine again if(!file_exists('/home/nve0s/public_html/chatswoodrangers/img/profiles/$id.jpg')) { if($extension==".jpg" or $extension==".jpeg") { $src_img = imagecreatefromjpeg("http://www.chatswoodrangers.com.au/teams/getpic.php?id=$id"); } else if($extension==".gif") { $src_img = imagecreatefromgif("http://www.chatswoodrangers.com.au/teams/getpic.php?id=$id"); } else if($extension==".bmp") { $src_img = imagecreatefromwbmp("http://www.chatswoodrangers.com.au/teams/getpic.php?id=$id"); } $dstimage = imagecreatetruecolor($imagewidth, $imageheight); imagecopyresampled ($dstimage, $src_img, 0, 0, 0, 0, $imagewidth, $imageheight, $imagehw[0], $imagehw[1]); imagejpeg ($dstimage, "/home/nve0s/public_html/chatswoodrangers/img/profiles/$id.jpg", 75); ImageDestroy($src_img); ImageDestroy($dstimage); } echo "<img src='/img/profiles/$id.jpg' border='0'>"; }