Re: [PHP] image question again
On Tue, 2010-04-06 at 21:44 -0500, Karl DeSaulniers wrote: When I have an imagecreatetruecolor and I create another one and use imagecopymerge, how do I keep the backgrounds transparent even if say the width of the top image is smaller than the back image? I keep getting a black background where the top image does not cover the back. It sets the transparency to the rest of the top image as long as it is covering the bottom one. I think it has to do with the imagealphablending. Any ideas? TIA Karl DeSaulniers Design Drumm http://designdrumm.com If it's just that the images are different sizes, then imagecopyresample might be the better option. Thanks, Ash http://www.ashleysheridan.co.uk
RE: [PHP] Image question
Jason Paschal posted this link a while ago, regarding storing and retriving images from MySQL: http://www.dailymedication.com/modules.php?name=Forumsfile=viewtopict= 15 -TG -Original Message- From: Ed Lazor [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 14, 2004 8:44 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] Image question Oop... spoke too soon. I was able to store the image into the database, but now I can't pull it back out and manipulate it with the gd image functions. Instead of using the imagejpeg function, I can just echo the field and the image will display in a browser window. How do I restore the data from the database in a way that I can continue to manipulate it with the image functions, like imagejpeg($data)? Thanks, Ed -Original Message- From: Ed Lazor [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 14, 2004 5:20 PM To: 'Jason Wong'; [EMAIL PROTECTED] Subject: RE: [PHP] Image question Got it. Thanks Jason. -Original Message- Imagejpeg($im); // successfully displays image Use the ob_*() functions to capture the output. See archives for details. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image question
On Wednesday 15 September 2004 08:05, Ed Lazor wrote: PHP's creating an image and I'm trying to store it into MySQL. Instead of raw binary data, all I'm getting is a resource reference. To test this and keep things as simple as possible, I took and created an image with createimagefromjpeg. Here's some example code of what I'm talking about: Imagejpeg($im); // successfully displays image Use the ob_*() functions to capture the output. See archives for details. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* ... the Mayo Clinic, named after its founder, Dr. Ted Clinic ... -- Dave Barry */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Image question
Got it. Thanks Jason. -Original Message- Imagejpeg($im); // successfully displays image Use the ob_*() functions to capture the output. See archives for details. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Image question
Oop... spoke too soon. I was able to store the image into the database, but now I can't pull it back out and manipulate it with the gd image functions. Instead of using the imagejpeg function, I can just echo the field and the image will display in a browser window. How do I restore the data from the database in a way that I can continue to manipulate it with the image functions, like imagejpeg($data)? Thanks, Ed -Original Message- From: Ed Lazor [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 14, 2004 5:20 PM To: 'Jason Wong'; [EMAIL PROTECTED] Subject: RE: [PHP] Image question Got it. Thanks Jason. -Original Message- Imagejpeg($im); // successfully displays image Use the ob_*() functions to capture the output. See archives for details. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image question
On Wednesday 15 September 2004 08:43, Ed Lazor wrote: Oop... spoke too soon. I was able to store the image into the database, but now I can't pull it back out and manipulate it with the gd image functions. Instead of using the imagejpeg function, I can just echo the field and the image will display in a browser window. How do I restore the data from the database in a way that I can continue to manipulate it with the image functions, like imagejpeg($data)? There's this thing called a manual, in there you would find: imagecreatefromstring() -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* It takes less time to do a thing right than it does to explain why you did it wrong. -- H.W. Longfellow */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image question
Tony, You might want to try the online php manual, I hear it's very good. You should be able to do all of the tasks you desire. Look for image in your search. Hope this helps. Hugh - Original Message - From: Anthony Ritter [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, March 10, 2003 10:23 AM Subject: [PHP] image question I'm looking for a php tutorial or script which can open and read an existing .jpg or .png from another URL. Next, the script then modifies that image by - say - cropping off the bottom by 20px or resizing it by 50%. Lastly, could this modified file then be renamed on ones server? Many thanks, Tony Ritter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Image Question
First, why store it in a database? Why not store it as a separate file, then store pointer/file-name to it in database? If you do want it in the database (may I assume mysql?), then INSERT/LOAD the file directly into the field without conversion. -Original Message- From: Jay Paulson [mailto:[EMAIL PROTECTED]] Sent: Monday, April 08, 2002 5:20 PM To: [EMAIL PROTECTED] Subject: [PHP] Image Question Hello everyone. I'm uploading an image, resizing it, then base64_encoding it to put the image into a data base.. then when I view it out of the data base using the base64_decode function it looks horrible. Below is the original image off of IMDB.com http://us.imdb.com/ImageView?u=http%3A//images.amazon.com/images/P/B5K3O 4.01.LZZZ.jpg And here is the image I get after the resize etc. http://www.dvdfuture.com/image.php?id=95 I'm using imagejpeg with the quality set to 90 so I really don't know why it's looking so badly. Thanks, Jay ps phpinfo is at the following URL http://www.dvdfuture.com/tests/testphp.phtml -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Question
Could it be you're unwittingly converting the graphic into 8bit color? That's certainly what it looks like. I've read that older versions of PHP and GD library don't always translate color depth. I don't have much experience programming graphics in PHP but I thought I'd offer up this possiblity. Hope it helps. -Kevin - Original Message - From: Rick Emery [EMAIL PROTECTED] To: 'Jay Paulson' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, April 08, 2002 4:19 PM Subject: RE: [PHP] Image Question First, why store it in a database? Why not store it as a separate file, then store pointer/file-name to it in database? If you do want it in the database (may I assume mysql?), then INSERT/LOAD the file directly into the field without conversion. -Original Message- From: Jay Paulson [mailto:[EMAIL PROTECTED]] Sent: Monday, April 08, 2002 5:20 PM To: [EMAIL PROTECTED] Subject: [PHP] Image Question Hello everyone. I'm uploading an image, resizing it, then base64_encoding it to put the image into a data base.. then when I view it out of the data base using the base64_decode function it looks horrible. Below is the original image off of IMDB.com http://us.imdb.com/ImageView?u=http%3A//images.amazon.com/images/P/B5K3O 4.01.LZZZ.jpg And here is the image I get after the resize etc. http://www.dvdfuture.com/image.php?id=95 I'm using imagejpeg with the quality set to 90 so I really don't know why it's looking so badly. Thanks, Jay ps phpinfo is at the following URL http://www.dvdfuture.com/tests/testphp.phtml -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Question
I'm putting it in the database because it's easier to handle that way, my site doesn't get too much traffic so it's not that big a load, and the files are usually between 2-8k which is tiny and the server should be able to handle that. Anyway, I have to resize the image because some of my writers don't know the first thing about image editing and can't resize the image themselves. - Original Message - From: Rick Emery [EMAIL PROTECTED] To: 'Jay Paulson' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, April 08, 2002 5:19 PM Subject: RE: [PHP] Image Question First, why store it in a database? Why not store it as a separate file, then store pointer/file-name to it in database? If you do want it in the database (may I assume mysql?), then INSERT/LOAD the file directly into the field without conversion. -Original Message- From: Jay Paulson [mailto:[EMAIL PROTECTED]] Sent: Monday, April 08, 2002 5:20 PM To: [EMAIL PROTECTED] Subject: [PHP] Image Question Hello everyone. I'm uploading an image, resizing it, then base64_encoding it to put the image into a data base.. then when I view it out of the data base using the base64_decode function it looks horrible. Below is the original image off of IMDB.com http://us.imdb.com/ImageView?u=http%3A//images.amazon.com/images/P/B5K3O 4.01.LZZZ.jpg And here is the image I get after the resize etc. http://www.dvdfuture.com/image.php?id=95 I'm using imagejpeg with the quality set to 90 so I really don't know why it's looking so badly. Thanks, Jay ps phpinfo is at the following URL http://www.dvdfuture.com/tests/testphp.phtml -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Question
Well my host had GD 2.0 or higher installed. Wonder if there is something I need to ask my host about the package they have installed? - Original Message - From: Kevin Stone [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, April 08, 2002 5:36 PM Subject: Re: [PHP] Image Question Could it be you're unwittingly converting the graphic into 8bit color? That's certainly what it looks like. I've read that older versions of PHP and GD library don't always translate color depth. I don't have much experience programming graphics in PHP but I thought I'd offer up this possiblity. Hope it helps. -Kevin - Original Message - From: Rick Emery [EMAIL PROTECTED] To: 'Jay Paulson' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, April 08, 2002 4:19 PM Subject: RE: [PHP] Image Question First, why store it in a database? Why not store it as a separate file, then store pointer/file-name to it in database? If you do want it in the database (may I assume mysql?), then INSERT/LOAD the file directly into the field without conversion. -Original Message- From: Jay Paulson [mailto:[EMAIL PROTECTED]] Sent: Monday, April 08, 2002 5:20 PM To: [EMAIL PROTECTED] Subject: [PHP] Image Question Hello everyone. I'm uploading an image, resizing it, then base64_encoding it to put the image into a data base.. then when I view it out of the data base using the base64_decode function it looks horrible. Below is the original image off of IMDB.com http://us.imdb.com/ImageView?u=http%3A//images.amazon.com/images/P/B5K3O 4.01.LZZZ.jpg And here is the image I get after the resize etc. http://www.dvdfuture.com/image.php?id=95 I'm using imagejpeg with the quality set to 90 so I really don't know why it's looking so badly. Thanks, Jay ps phpinfo is at the following URL http://www.dvdfuture.com/tests/testphp.phtml -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Question
At 5:56 PM -0500 8/4/02, Jay Paulson wrote: Well my host had GD 2.0 or higher installed. Wonder if there is something I need to ask my host about the package they have installed? You do create a new image with ImageCreateTrueColor don't you? This works for me: $tmp_img = ImageCreateTrueColor($sxd, $syd); ImageInterlace($tmp_img, 1); ImageCopyResized( $tmp_img, $src_img, 0,0,$sx1, $sy1, $sxd, $syd, $sxd, $syd); ImageCopyResampled($dst_img, $tmp_img, 0,0,0,0,$dx, $dy, $sxd, $syd); $tmpfname = tempnam(/tmp, MyJPG); imagejpeg($dst_img, $tmpfname, $jpeg_quality); imagedestroy($src_img); imagedestroy($dst_img); ## Read the image back in $fd = fopen($tmpfname, r); $photo = fread($fd, filesize($tmpfname)); fclose($fd); unlink ($tmpfname); ...R. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php