Re: [PHP] Image Generation
I don't think GD has a built-in function to scale an image the way you are asking, and to do it on a pixel by pixel basis from within a function is going to be a very time consuming and memory costly process. Have you thought about using ImageMagik to do this? I know that you can exec() out to this from within Windows and Linux, and ImageMagik is free to use (as far as I'm aware) so it could be just what you need. Ash www.ashleysheridan.co.uk ---BeginMessage--- Hi, I need to generate an online proof for vinyl lettering. Customers specify the text, font, colour, maximum frame size (mm) (ie the width and height it must fit into), and whether or not they want to keep aspect ratio (ie not distort the lettering). I want to represent all this on a single image. So it would display a border with their width and height on, and inside this would be the text in the appropriate colour and font – if they decide to keep aspect ratio the text would not be distorted. If they do not, it would be. The image would always be 300px wide by 150px high (these would need to be constants that I could change from time to time). I’ve got a very basic proof working using a GD wrapper, but I don’t think GD is powerful enough to do it all, nor do I recon my programming skills are up for it. Has anybody got any advice on how to tackle this, even if it is just bits of the problem?? Thanks, Alex Chamberlain No virus found in this outgoing message. Scanned by AVG Free 8.0 Checked by AVG - http://www.avg.com Version: 8.0.138 / Virus Database: 270.6.6/1621 - Release Date: 19/08/2008 18:53 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Generation
Alex Chamberlain schreef: Hi, I need to generate an online proof for vinyl lettering. Customers specify the text, font, colour, maximum frame size (mm) (ie the width and height it must fit into), and whether or not they want to keep aspect ratio (ie not distort the lettering). I want to represent all this on a single image. So it would display a border with their width and height on, and inside this would be the text in the appropriate colour and font – if they decide to keep aspect ratio the text would not be distorted. If they do not, it would be. The image would always be 300px wide by 150px high (these would need to be constants that I could change from time to time). I’ve got a very basic proof working using a GD wrapper, but I don’t think GD is powerful enough to do it all, nor do I recon my programming skills are up for it. Has anybody got any advice on how to tackle this, even if it is just bits of the problem?? GD can do all this, although I hear said that ImageMagick does more and has somewhat better output. you'll only be able to offer fonts that you have installed on the server, also image generation works in pixels so you'll have to come up with a way to 'convert' millimeters to a pixel value for display purposes. I offer you a class that you might be able to use, at least for inspiration ... the pertinent functions used are ImageColorAllocate(), ImageTTFBBox() and ImageTTFText() ? /* * Example: $renderer = new RenderTTFText( 81, 756 ); $renderer-setOffset( 28, 40 ); $renderer-setBgImage( '/images/headerbase-lightblue.jpg' ); // $renderer-setBgColor( ??? ); $renderer-setLifetime( 1000 ); // $renderer-setMaxLines( 1 ) $renderer-render( array( 'THESE', 'ARE', 'strings' ), array( 10, 14, 18 ), array( '/fonts/arial.ttf', '/fonts/verdana.ttf', '/fonts/symbol.ttf' ), ); * */ class RenderTTFText { var $xsize, $ysize; var $xoffset, $yoffset, $margin; var $bgimage, $bgimagetype; var $bgcolor, $fgcolor; var $lifetime; var $maxLines; var $transparent; // nasty little hack :-) var $stringSpacingOffsetTweak; var $im; // reference to the image resource. function RenderTTFText($xsize = null, $ysize = null) { $this-xsize= (is_integer($xsize) $xsize) ? 100: $xsize; $this-ysize= (is_integer($ysize) $ysize) ? 100: $ysize; $this-xoffset = 0; $this-yoffset = 0; $this-margin = 0; $this-bgcolor = array(0,0,0); $this-fgcolor = array(255,255,255); $this-lifetime = 0; $this-maxLines = 1; $this-transparent = false; $this-stringSpacingOffsetTweak = 0; } function setOffset($x,$y,$m = 0) { $this-xoffset = intval($x); $this-yoffset = intval($y); $this-margin = intval($y); } function setBgImage($img_file) { $this-bgimage = $img_file; list($this-xsize, $this-ysize, $this-bgimagetype) = GetImageSize($this-bgimage); } function setBgColor($color) { $this-bgcolor = $this-convColor($color); } function setLifetime($t) { $this-lifetime = intval($t); } function setMaxLines($l) { if (($l = intval($l)) 0) { $this-maxLines = $l; } } function setTransparent($b = true) { $this-transparent = (boolean)$b; } function setStringSpacingOffsetTweak($v) { if (is_numeric($v)) { $this-stringSpacingOffsetTweak = $v; } } /* * $text, a string or array of strings. - strings to display in order. * $size, a float or an array of floats - which size to display the related text at. * $font, a fontfilename or an array of fontfilenames - which font to use for the related text string * $br, a boolean, or an array of bools - whether to follow the related $text string with a line break */ function render($text, $size, $font, $color, $br = false) { /* our text items to render (each item can have a seperate size, font and linebreak(true/false) */ foreach (array('text','size','font','color','br') as $arg) { if (!is_array(${$arg})) $$arg = array(${$arg}); if ($arg == 'text') { $tcount = count($text); $text = array_map('trim', $text); } else { while (($c = count(${$arg})) $tcount) { if (!isset(${$arg}[$c - 1])) { return false; } ${$arg}[$c] = ($arg == 'br') ? false : ${$arg}[$c - 1]; } } ${$arg} = array_values(${$arg}); } /* create the background/base image */ if (! empty($this-bgimage)) { switch ($this-bgimagetype) { case 3:
Re: [PHP] Image Generation
Ashley Sheridan schreef: I don't think GD has a built-in function to scale an image the way you are asking, of course you can scale images with GD, but everything works in pixels, ImageMagick is no different ... there is no such thing as millimeters when it comes to bitmap images, you can specify an output resolution when printing but that has no direct bearing on the image file itself. Alex will have to figure out the bounding box ratios of the dimensions given in mm and transpose that into the 300x150 pixel image he's going to use as a canvas, the math is not that hard (can't be if I can manage it!) and although it won't be a perfect at all times he did mention it's a representation. If Alex requires pixel perfect representation of print output in a file then he is going to have to resort to some kind of vector based image representation (e.g. Adobe Illustrator) but scripting that with php is possibly going to be very tricky, either using a COM object or shelling out to something like AppleScript (which I know you can use to do some really crazy Illustrator scripting with) and to do it on a pixel by pixel basis from within a function is going to be a very time consuming and memory costly process. Have you thought about using ImageMagik to do this? I know that you can exec() out to this from within Windows and Linux, and ImageMagik is free to use (as far as I'm aware) so it could be just what you need. Ash www.ashleysheridan.co.uk Onderwerp: [PHP] Image Generation Van: Alex Chamberlain [EMAIL PROTECTED] Datum: Wed, 20 Aug 2008 08:29:50 +0100 Aan: PHP General list php-general@lists.php.net Aan: PHP General list php-general@lists.php.net Return-path: [EMAIL PROTECTED] Envelope-to: [EMAIL PROTECTED] Delivery-date: Wed, 20 Aug 2008 08:30:52 +0100 Received: from [216.92.131.4] (port=26599 helo=lists.php.net) by zencphosting11.zen.co.uk with esmtp (Exim 4.68) (envelope-from [EMAIL PROTECTED]) id 1KVi9b-0007aA-Qe for [EMAIL PROTECTED]; Wed, 20 Aug 2008 08:30:51 +0100 X-Host-Fingerprint: 216.92.131.4 lists.php.net Received: from [216.92.131.4] ([216.92.131.4:26502] helo=lists.php.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B7/47-51571-A28CBA84 for [EMAIL PROTECTED]; Wed, 20 Aug 2008 03:30:50 -0400 Received: (qmail 5047 invoked by uid 1010); 20 Aug 2008 07:30:37 - Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm Precedence: bulk list-help: mailto:[EMAIL PROTECTED] list-unsubscribe: mailto:[EMAIL PROTECTED] list-post: mailto:php-general@lists.php.net Delivered-To: mailing list php-general@lists.php.net Received: (qmail 5040 invoked from network); 20 Aug 2008 07:30:37 - Authentication-Results: pb1.pair.com [EMAIL PROTECTED]; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com [EMAIL PROTECTED]; sender-id=unknown Received-SPF: error (pb1.pair.com: domain alexchamberlain.co.uk from 79.170.40.18 cause and error) X-PHP-List-Original-Sender: [EMAIL PROTECTED] X-Host-Fingerprint: 79.170.40.18 mail18.extendcp.co.uk Linux 2.5 (sometimes 2.4) (4) Bericht-ID: [EMAIL PROTECTED] MIME-versie: 1.0 Content-Type: text/plain; charset=windows-1250 X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AckCloefPR8PGF4zQNGV6eViXsKrxQ== Content-Language: en-gb Content-Transfer-Encoding: base64 Hi, I need to generate an online proof for vinyl lettering. Customers specify the text, font, colour, maximum frame size (mm) (ie the width and height it must fit into), and whether or not they want to keep aspect ratio (ie not distort the lettering). I want to represent all this on a single image. So it would display a border with their width and height on, and inside this would be the text in the appropriate colour and font – if they decide to keep aspect ratio the text would not be distorted. If they do not, it would be. The image would always be 300px wide by 150px high (these would need to be constants that I could change from time to time). I’ve got a very basic proof working using a GD wrapper, but I don’t think GD is powerful enough to do it all, nor do I recon my programming skills are up for it. Has anybody got any advice on how to tackle this, even if it is just bits of the problem?? Thanks, Alex Chamberlain No virus found in this outgoing message. Scanned by AVG Free 8.0 Checked by AVG - http://www.avg.com Version: 8.0.138 / Virus Database: 270.6.6/1621 - Release Date: 19/08/2008 18:53 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Generation
Hence me saying in the way you are asking I know GD can scale images (I've done that myself on more than one occassion), but not images that are intended for print as opposed to screen viewing, as this appears to be. As for quality, I've found that GD offers comparable quality images to ImageMagik, and in better time more often than not. The main advantage ImageMagik has is with functionality; quite simply, it can do much more than GD and GD2. Ash www.ashleysheridan.co.uk ---BeginMessage--- Ashley Sheridan schreef: I don't think GD has a built-in function to scale an image the way you are asking, of course you can scale images with GD, but everything works in pixels, ImageMagick is no different ... there is no such thing as millimeters when it comes to bitmap images, you can specify an output resolution when printing but that has no direct bearing on the image file itself. Alex will have to figure out the bounding box ratios of the dimensions given in mm and transpose that into the 300x150 pixel image he's going to use as a canvas, the math is not that hard (can't be if I can manage it!) and although it won't be a perfect at all times he did mention it's a representation. If Alex requires pixel perfect representation of print output in a file then he is going to have to resort to some kind of vector based image representation (e.g. Adobe Illustrator) but scripting that with php is possibly going to be very tricky, either using a COM object or shelling out to something like AppleScript (which I know you can use to do some really crazy Illustrator scripting with) and to do it on a pixel by pixel basis from within a function is going to be a very time consuming and memory costly process. Have you thought about using ImageMagik to do this? I know that you can exec() out to this from within Windows and Linux, and ImageMagik is free to use (as far as I'm aware) so it could be just what you need. Ash www.ashleysheridan.co.uk Onderwerp: [PHP] Image Generation Van: Alex Chamberlain [EMAIL PROTECTED] Datum: Wed, 20 Aug 2008 08:29:50 +0100 Aan: PHP General list php-general@lists.php.net Aan: PHP General list php-general@lists.php.net Return-path: [EMAIL PROTECTED] Envelope-to: [EMAIL PROTECTED] Delivery-date: Wed, 20 Aug 2008 08:30:52 +0100 Received: from [216.92.131.4] (port=26599 helo=lists.php.net) by zencphosting11.zen.co.uk with esmtp (Exim 4.68) (envelope-from [EMAIL PROTECTED]) id 1KVi9b-0007aA-Qe for [EMAIL PROTECTED]; Wed, 20 Aug 2008 08:30:51 +0100 X-Host-Fingerprint: 216.92.131.4 lists.php.net Received: from [216.92.131.4] ([216.92.131.4:26502] helo=lists.php.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B7/47-51571-A28CBA84 for [EMAIL PROTECTED]; Wed, 20 Aug 2008 03:30:50 -0400 Received: (qmail 5047 invoked by uid 1010); 20 Aug 2008 07:30:37 - Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm Precedence: bulk list-help: mailto:[EMAIL PROTECTED] list-unsubscribe: mailto:[EMAIL PROTECTED] list-post: mailto:php-general@lists.php.net Delivered-To: mailing list php-general@lists.php.net Received: (qmail 5040 invoked from network); 20 Aug 2008 07:30:37 - Authentication-Results: pb1.pair.com [EMAIL PROTECTED]; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com [EMAIL PROTECTED]; sender-id=unknown Received-SPF: error (pb1.pair.com: domain alexchamberlain.co.uk from 79.170.40.18 cause and error) X-PHP-List-Original-Sender: [EMAIL PROTECTED] X-Host-Fingerprint: 79.170.40.18 mail18.extendcp.co.uk Linux 2.5 (sometimes 2.4) (4) Bericht-ID: [EMAIL PROTECTED] MIME-versie: 1.0 Content-Type: text/plain; charset=windows-1250 X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AckCloefPR8PGF4zQNGV6eViXsKrxQ== Content-Language: en-gb Content-Transfer-Encoding: base64 Hi, I need to generate an online proof for vinyl lettering. Customers specify the text, font, colour, maximum frame size (mm) (ie the width and height it must fit into), and whether or not they want to keep aspect ratio (ie not distort the lettering). I want to represent all this on a single image. So it would display a border with their width and height on, and inside this would be the text in the appropriate colour and font – if they decide to keep aspect ratio the text would not be distorted. If they do not, it would be. The image would always be 300px wide by 150px high (these would need to be constants that I could change from time to time). I’ve got a very basic proof working using a GD wrapper, but I don’t think GD is powerful enough to do it all, nor do I recon my programming skills are up for it. Has anybody got any advice on how to tackle this, even if it is just bits of the problem?? Thanks, Alex Chamberlain No virus found in this outgoing message. Scanned by AVG Free 8.0 Checked by AVG - http://www.avg.com Version: 8.0.138 / Virus Database: 270.6.6/1621 - Release Date:
Re: [PHP] Image Generation
Ashley Sheridan schreef: Hence me saying in the way you are asking I know GD can scale images (I've done that myself on more than one occassion), but not images that are intended for print as opposed to screen viewing, as this appears to be. I can't see how imagemagick helps here, it's a bitmap manipulator just like GD. so it's either use something that generates vector based output (and let the printersubsytem handle the conversion) or generate massive bitmaps and print them at a very high DPI. As for quality, I've found that GD offers comparable quality images to ImageMagik, and in better time more often than not. The main advantage ImageMagik has is with functionality; quite simply, it can do much more than GD and GD2. I'll take your word on that, I've never played with imagemagick, having found GD to produce quality good enough for my needs. Ash www.ashleysheridan.co.uk Onderwerp: Re: [PHP] Image Generation Van: Jochem Maas [EMAIL PROTECTED] Datum: Wed, 20 Aug 2008 11:06:14 +0200 Aan: [EMAIL PROTECTED] Aan: [EMAIL PROTECTED] CC: Alex Chamberlain [EMAIL PROTECTED], PHP General list php-general@lists.php.net Return-path: [EMAIL PROTECTED] Envelope-to: [EMAIL PROTECTED] Delivery-date: Wed, 20 Aug 2008 10:06:54 +0100 Received: from [216.92.131.4] (port=19732 helo=lists.php.net) by zencphosting11.zen.co.uk with esmtp (Exim 4.68) (envelope-from [EMAIL PROTECTED]) id 1KVjeX-0001J1-OZ for [EMAIL PROTECTED]; Wed, 20 Aug 2008 10:06:54 +0100 X-Host-Fingerprint: 216.92.131.4 lists.php.net Received: from [216.92.131.4] ([216.92.131.4:19612] helo=lists.php.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 54/0E-51571-CAEDBA84 for [EMAIL PROTECTED]; Wed, 20 Aug 2008 05:06:52 -0400 Received: (qmail 38571 invoked by uid 1010); 20 Aug 2008 09:06:34 - Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm Precedence: bulk list-help: mailto:[EMAIL PROTECTED] list-unsubscribe: mailto:[EMAIL PROTECTED] list-post: mailto:php-general@lists.php.net Delivered-To: mailing list php-general@lists.php.net Received: (qmail 38564 invoked from network); 20 Aug 2008 09:06:34 - Authentication-Results: pb1.pair.com [EMAIL PROTECTED]; sender-id=unknown Authentication-Results: pb1.pair.com [EMAIL PROTECTED]; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain iamjochem.com from 194.109.193.121 cause and error) X-PHP-List-Original-Sender: [EMAIL PROTECTED] X-Host-Fingerprint: 194.109.193.121 mx1.moulin.nl Linux 2.6 X-Virus-Scanned: amavisd-new at moulin.nl Bericht-ID: [EMAIL PROTECTED] User-agent: Thunderbird 2.0.0.16 (Macintosh/20080707) MIME-versie: 1.0 Referenties: [EMAIL PROTECTED] [EMAIL PROTECTED] In-Reply-To: [EMAIL PROTECTED] X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: base64 Ashley Sheridan schreef: I don't think GD has a built-in function to scale an image the way you are asking, of course you can scale images with GD, but everything works in pixels, ImageMagick is no different ... there is no such thing as millimeters when it comes to bitmap images, you can specify an output resolution when printing but that has no direct bearing on the image file itself. Alex will have to figure out the bounding box ratios of the dimensions given in mm and transpose that into the 300x150 pixel image he's going to use as a canvas, the math is not that hard (can't be if I can manage it!) and although it won't be a perfect at all times he did mention it's a representation. If Alex requires pixel perfect representation of print output in a file then he is going to have to resort to some kind of vector based image representation (e.g. Adobe Illustrator) but scripting that with php is possibly going to be very tricky, either using a COM object or shelling out to something like AppleScript (which I know you can use to do some really crazy Illustrator scripting with) and to do it on a pixel by pixel basis from within a function is going to be a very time consuming and memory costly process. Have you thought about using ImageMagik to do this? I know that you can exec() out to this from within Windows and Linux, and ImageMagik is free to use (as far as I'm aware) so it could be just what you need. Ash www.ashleysheridan.co.uk Onderwerp: [PHP] Image Generation Van: Alex Chamberlain [EMAIL PROTECTED] Datum: Wed, 20 Aug 2008 08:29:50 +0100 Aan: PHP General list php-general@lists.php.net Aan: PHP General list php-general@lists.php.net Return-path: [EMAIL PROTECTED] Envelope-to: [EMAIL PROTECTED] Delivery-date: Wed, 20 Aug 2008 08:30:52 +0100 Received: from [216.92.131.4] (port=26599 helo=lists.php.net) by zencphosting11.zen.co.uk with esmtp (Exim 4.68) (envelope-from [EMAIL PROTECTED]) id 1KVi9b-0007aA-Qe for [EMAIL PROTECTED]; Wed
Re: Re: [PHP] Image Generation
BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; } Just to clarify some points, there is no need for this to be of print quality - it is an online representation of the vinyl they will recieve in the post. Also, the main problem I've got with GD, is generating text that is stretched? Do I need to generate a text image then stretch this using normal resize functions?? Alex On Wed , Jochem Maas [EMAIL PROTECTED] sent: Ashley Sheridan schreef: Hence me saying in the way you are asking I know GD can scale images (I've done that myself on more than one occassion), but not images that are intended for print as opposed to screen viewing, as this appears to be. I can't see how imagemagick helps here, it's a bitmap manipulator just like GD. so it's either use something that generates vector based output (and let the printersubsytem handle the conversion) or generate massive bitmaps and print them at a very high DPI. As for quality, I've found that GD offers comparable quality images to ImageMagik, and in better time more often than not. The main advantage ImageMagik has is with functionality; quite simply, it can do much more than GD and GD2. I'll take your word on that, I've never played with imagemagick, having found GD to produce quality good enough for my needs. Ash www.ashleysheridan.co.uk [1] Onderwerp: Re: [PHP] Image Generation Van: Jochem Maas Datum: Wed, 20 Aug 2008 11:06:14 +0200 Aan: [EMAIL PROTECTED] [3] Aan: [EMAIL PROTECTED] [4] CC: Alex Chamberlain , PHP General list Return-path: [EMAIL PROTECTED] Envelope-to: [EMAIL PROTECTED] [7] Delivery-date: Wed, 20 Aug 2008 10:06:54 +0100 Received: from [216.92.131.4] (port=19732 helo=lists.php.net) by zencphosting11.zen.co.uk with esmtp (Exim 4.68) (envelope-from [EMAIL PROTECTED]) id 1KVjeX-0001J1-OZ for [EMAIL PROTECTED] [8]; Wed, 20 Aug 2008 10:06:54 +0100 X-Host-Fingerprint: 216.92.131.4 lists.php.net Received: from [216.92.131.4] ([216.92.131.4:19612] helo=lists.php.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 54/0E-51571-CAEDBA84 for ; Wed, 20 Aug 2008 05:06:52 -0400 Received: (qmail 38571 invoked by uid 1010); 20 Aug 2008 09:06:34 - Mailing-List: contact [EMAIL PROTECTED] [10]; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Delivered-To: mailing list php-general@lists.php.net [14] Received: (qmail 38564 invoked from network); 20 Aug 2008 09:06:34 - Authentication-Results: pb1.pair.com [EMAIL PROTECTED] [15]; sender-id=unknown Authentication-Results: pb1.pair.com [EMAIL PROTECTED] [16]; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain iamjochem.com from 194.109.193.121 cause and error) X-PHP-List-Original-Sender: [EMAIL PROTECTED] [17] X-Host-Fingerprint: 194.109.193.121 mx1.moulin.nl Linux 2.6 X-Virus-Scanned: amavisd-new at moulin.nl Bericht-ID: User-agent: Thunderbird 2.0.0.16 (Macintosh/20080707) MIME-versie: 1.0 Referenties: In-Reply-To: X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: base64 Ashley Sheridan schreef: I don't think GD has a built-in function to scale an image the way you are asking, of course you can scale images with GD, but everything works in pixels, ImageMagick is no different ... there is no such thing as millimeters when it comes to bitmap images, you can specify an output resolution when printing but that has no direct bearing on the image file itself. Alex will have to figure out the bounding box ratios of the dimensions given in mm and transpose that into the 300x150 pixel image he's going to use as a canvas, the math is not that hard (can't be if I can manage it!) and although it won't be a perfect at all times he did mention it's a representation. If Alex requires pixel perfect representation of print output in a file then he is going to have to resort to some kind of vector based image representation (e.g. Adobe Illustrator) but scripting that with php is possibly going to be very tricky, either using a COM object or shelling out to something like AppleScript (which I know you can use to do some really crazy Illustrator scripting with) and to do it on a pixel by pixel basis from within a function is going to be a very time consuming and memory costly process. Have you thought about using ImageMagik to do this? I know that you can exec() out to this from within Windows and Linux, and ImageMagik is free to use (as far as I'm aware) so
Re: Re: [PHP] Image Generation
Yes, if you wish to stretch text in this way then you will have to create the image and stretch. You can create the image in memory and perform the stretching on it there if you are worried about writing too many temporary images to the server. Ash www.ashleysheridan.co.uk ---BeginMessage--- BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; } Just to clarify some points, there is no need for this to be of print quality - it is an online representation of the vinyl they will recieve in the post. Also, the main problem I've got with GD, is generating text that is stretched? Do I need to generate a text image then stretch this using normal resize functions?? Alex On Wed , Jochem Maas [EMAIL PROTECTED] sent: Ashley Sheridan schreef: Hence me saying in the way you are asking I know GD can scale images (I've done that myself on more than one occassion), but not images that are intended for print as opposed to screen viewing, as this appears to be. I can't see how imagemagick helps here, it's a bitmap manipulator just like GD. so it's either use something that generates vector based output (and let the printersubsytem handle the conversion) or generate massive bitmaps and print them at a very high DPI. As for quality, I've found that GD offers comparable quality images to ImageMagik, and in better time more often than not. The main advantage ImageMagik has is with functionality; quite simply, it can do much more than GD and GD2. I'll take your word on that, I've never played with imagemagick, having found GD to produce quality good enough for my needs. Ash www.ashleysheridan.co.uk [1] Onderwerp: Re: [PHP] Image Generation Van: Jochem Maas Datum: Wed, 20 Aug 2008 11:06:14 +0200 Aan: [EMAIL PROTECTED] [3] Aan: [EMAIL PROTECTED] [4] CC: Alex Chamberlain , PHP General list Return-path: [EMAIL PROTECTED] Envelope-to: [EMAIL PROTECTED] [7] Delivery-date: Wed, 20 Aug 2008 10:06:54 +0100 Received: from [216.92.131.4] (port=19732 helo=lists.php.net) by zencphosting11.zen.co.uk with esmtp (Exim 4.68) (envelope-from [EMAIL PROTECTED]) id 1KVjeX-0001J1-OZ for [EMAIL PROTECTED] [8]; Wed, 20 Aug 2008 10:06:54 +0100 X-Host-Fingerprint: 216.92.131.4 lists.php.net Received: from [216.92.131.4] ([216.92.131.4:19612] helo=lists.php.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 54/0E-51571-CAEDBA84 for ; Wed, 20 Aug 2008 05:06:52 -0400 Received: (qmail 38571 invoked by uid 1010); 20 Aug 2008 09:06:34 - Mailing-List: contact [EMAIL PROTECTED] [10]; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Delivered-To: mailing list php-general@lists.php.net [14] Received: (qmail 38564 invoked from network); 20 Aug 2008 09:06:34 - Authentication-Results: pb1.pair.com [EMAIL PROTECTED] [15]; sender-id=unknown Authentication-Results: pb1.pair.com [EMAIL PROTECTED] [16]; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain iamjochem.com from 194.109.193.121 cause and error) X-PHP-List-Original-Sender: [EMAIL PROTECTED] [17] X-Host-Fingerprint: 194.109.193.121 mx1.moulin.nl Linux 2.6 X-Virus-Scanned: amavisd-new at moulin.nl Bericht-ID: User-agent: Thunderbird 2.0.0.16 (Macintosh/20080707) MIME-versie: 1.0 Referenties: In-Reply-To: X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: base64 Ashley Sheridan schreef: I don't think GD has a built-in function to scale an image the way you are asking, of course you can scale images with GD, but everything works in pixels, ImageMagick is no different ... there is no such thing as millimeters when it comes to bitmap images, you can specify an output resolution when printing but that has no direct bearing on the image file itself. Alex will have to figure out the bounding box ratios of the dimensions given in mm and transpose that into the 300x150 pixel image he's going to use as a canvas, the math is not that hard (can't be if I can manage it!) and although it won't be a perfect at all times he did mention it's a representation. If Alex requires pixel perfect representation of print output in a file then he is going to have to resort to some kind of vector based image representation (e.g. Adobe Illustrator) but scripting that with php is possibly going to be very tricky, either using a COM object or shelling out to something like AppleScript (which I know you can use to do some really crazy Illustrator scripting with) and to do it on a pixel
Re: Re: [PHP] Image Generation
Hi Alex, I did reply to this, but it apparently didn't get to you. You will need to create a separate image with the text in, as GD offers no function to create text already stretched (actually, it's text offerings are sparse to say the least). You can create this image in memory if you are worrying about creating a lot of files on your server though, and then perform resizing operations on the image in memory. Ash www.ashleysheridan.co.uk ---BeginMessage--- BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; } Just to clarify some points, there is no need for this to be of print quality - it is an online representation of the vinyl they will recieve in the post. Also, the main problem I've got with GD, is generating text that is stretched? Do I need to generate a text image then stretch this using normal resize functions?? Alex On Wed , Jochem Maas [EMAIL PROTECTED] sent: Ashley Sheridan schreef: Hence me saying in the way you are asking I know GD can scale images (I've done that myself on more than one occassion), but not images that are intended for print as opposed to screen viewing, as this appears to be. I can't see how imagemagick helps here, it's a bitmap manipulator just like GD. so it's either use something that generates vector based output (and let the printersubsytem handle the conversion) or generate massive bitmaps and print them at a very high DPI. As for quality, I've found that GD offers comparable quality images to ImageMagik, and in better time more often than not. The main advantage ImageMagik has is with functionality; quite simply, it can do much more than GD and GD2. I'll take your word on that, I've never played with imagemagick, having found GD to produce quality good enough for my needs. Ash www.ashleysheridan.co.uk [1] Onderwerp: Re: [PHP] Image Generation Van: Jochem Maas Datum: Wed, 20 Aug 2008 11:06:14 +0200 Aan: [EMAIL PROTECTED] [3] Aan: [EMAIL PROTECTED] [4] CC: Alex Chamberlain , PHP General list Return-path: [EMAIL PROTECTED] Envelope-to: [EMAIL PROTECTED] [7] Delivery-date: Wed, 20 Aug 2008 10:06:54 +0100 Received: from [216.92.131.4] (port=19732 helo=lists.php.net) by zencphosting11.zen.co.uk with esmtp (Exim 4.68) (envelope-from [EMAIL PROTECTED]) id 1KVjeX-0001J1-OZ for [EMAIL PROTECTED] [8]; Wed, 20 Aug 2008 10:06:54 +0100 X-Host-Fingerprint: 216.92.131.4 lists.php.net Received: from [216.92.131.4] ([216.92.131.4:19612] helo=lists.php.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 54/0E-51571-CAEDBA84 for ; Wed, 20 Aug 2008 05:06:52 -0400 Received: (qmail 38571 invoked by uid 1010); 20 Aug 2008 09:06:34 - Mailing-List: contact [EMAIL PROTECTED] [10]; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Delivered-To: mailing list php-general@lists.php.net [14] Received: (qmail 38564 invoked from network); 20 Aug 2008 09:06:34 - Authentication-Results: pb1.pair.com [EMAIL PROTECTED] [15]; sender-id=unknown Authentication-Results: pb1.pair.com [EMAIL PROTECTED] [16]; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain iamjochem.com from 194.109.193.121 cause and error) X-PHP-List-Original-Sender: [EMAIL PROTECTED] [17] X-Host-Fingerprint: 194.109.193.121 mx1.moulin.nl Linux 2.6 X-Virus-Scanned: amavisd-new at moulin.nl Bericht-ID: User-agent: Thunderbird 2.0.0.16 (Macintosh/20080707) MIME-versie: 1.0 Referenties: In-Reply-To: X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: base64 Ashley Sheridan schreef: I don't think GD has a built-in function to scale an image the way you are asking, of course you can scale images with GD, but everything works in pixels, ImageMagick is no different ... there is no such thing as millimeters when it comes to bitmap images, you can specify an output resolution when printing but that has no direct bearing on the image file itself. Alex will have to figure out the bounding box ratios of the dimensions given in mm and transpose that into the 300x150 pixel image he's going to use as a canvas, the math is not that hard (can't be if I can manage it!) and although it won't be a perfect at all times he did mention it's a representation. If Alex requires pixel perfect representation of print output in a file then he is going to have to resort to some kind of vector based image representation (e.g. Adobe Illustrator) but scripting that with php is possibly going to be very tricky, either using a COM
Re: [PHP] Image Generation: Centering Text
Hello Richard, Monday, May 2, 2005, 4:47:42 PM, you wrote: RC But I need to center the text in the image that is generated. As I RC am using the same font and it is fixed at 10px I was thinking of RC doing something like: RC (Get Length of Text in Chars * Width of Average Char) DIV 2. RC (Width of Image DIV 2) - Above = starting point on the x axis. RC or can anyone think of a better way to do it? There's nothing wrong with this method at all. When using a fixed width font I would do it like this, it's pretty much perfect. When using a True Type font I would use imagettfbbox() instead to get the width of the text and then center that accordingly. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image generation Problems (jpeg)
At 29.04.2002 20:02, you wrote: = PLEASE CC ALL AWNSERS TO [EMAIL PROTECTED] = hi, im having a few problems installing GD, ill start from the top: I need Jpeg support in my PHP installation, and unfortunatly, GD (the verison i have) does not support them, so i figure, ill install it, installing the libary jpeg-6b works easily however, i attempt to compile from there GD, but the following error is produced: [root gd-1.8.4]# make gcc -I. -I/usr/include/freetype2 -I/usr/include/X11 -I/usr/X11R6/include/X11 -I/usr/local/include -c -o gd_gd2.o gd_gd2.c In file included from /usr/include/errno.h:36, from gd_gd2.c:14: /usr/include/bits/errno.h:25: linux/errno.h: No such file or directory make: *** [gd_gd2.o] Error 1 I also tried recompiling PHP and got a similar error, which is very worrying, i think i might be missing some files Basically, waht i would really like, is a way to modify my CURRENT php config or my CURRENT gd config to take advantage of my shiny new jpeg libary, is there any method u can recommend to accomplish this? Thanks Peter = PLEASE CC ALL AWNSERS TO [EMAIL PROTECTED] == Check out the config file for gd, the path to the jpeg-6b must be included. There´s some problem of the order of the files, but there are more info in the config file. Also the path where the jpg libs are installed, is sometimes different, so you have to check them too. HTH Oliver -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image generation Problems (jpeg)
On Monday 29 April 2002 20:02, Peter Revill wrote: hi, im having a few problems installing GD, ill start from the top: I need Jpeg support in my PHP installation, and unfortunatly, GD (the verison i have) does not support them, so i figure, ill install it, installing the libary jpeg-6b works easily however, i attempt to compile from there GD, but the following error is produced: It's usually a good idea to state what kind of setup you have (OS, version etc). [root gd-1.8.4]# make gcc -I. -I/usr/include/freetype2 -I/usr/include/X11 -I/usr/X11R6/include/X11 -I/usr/local/include -c -o gd_gd2.o gd_gd2.c In file included from /usr/include/errno.h:36, from gd_gd2.c:14: /usr/include/bits/errno.h:25: linux/errno.h: No such file or directory make: *** [gd_gd2.o] Error 1 Have you checked that you have the file linux/errno.h anywhere in your system? On my RH7.1 system, /usr/include/linux/errno.h is provided by kernel-headers, so if don't have it and you're using RH, install kernel-headers. If you're using something else check with your distro vendor. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* That unit is a woman. A mass of conflicting impulses. -- Spock and Nomad, The Changeling, stardate 3541.9 */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image generation Problems (jpeg)
Jason Wong wrote: On Monday 29 April 2002 20:02, Peter Revill wrote: hi, im having a few problems installing GD, ill start from the top: I need Jpeg support in my PHP installation, and unfortunatly, GD (the verison i have) does not support them, so i figure, ill install it, installing the libary jpeg-6b works easily however, i attempt to compile from there GD, but the following error is produced: It's usually a good idea to state what kind of setup you have (OS, version etc). Im not even sure myself, linux on 2.2.14 on what should be a redhat box i know theres a command something like dsmod to get the info, hmm.. oot gd-1.8.4]# make gcc -I. -I/usr/include/freetype2 -I/usr/include/X11 -I/usr/X11R6/include/X11 -I/usr/local/include -c -o gd_gd2.o gd_gd2.c In file included from /usr/include/errno.h:36, from gd_gd2.c:14: /usr/include/bits/errno.h:25: linux/errno.h: No such file or directory make: *** [gd_gd2.o] Error 1 Have you checked that you have the file linux/errno.h anywhere in your system? yes, but it wasnt around, errno.h was, but not errno.h like that On my RH7.1 system, /usr/include/linux/errno.h is provided by kernel-headers, so if don't have it and you're using RH, install kernel-headers. If you're using something else check with your distro vendor. i found the kernel-headers package, but it msut be damaged or something (rpm --query says it exists, but i have my doubts as to the files still existing) is it OK to install kernel headers of a diffirent kernel number? i.e. if i install kernel-headers 2.4.1 or wahtever is that ok? or will that cause problems? (im betting money on it will cause problems) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image generation Problems (jpeg)
On Monday 29 April 2002 21:40, Peter Revill wrote: Im not even sure myself, linux on 2.2.14 on what should be a redhat box i know theres a command something like dsmod to get the info, hmm.. Never mind, as long as you're reasonably sure it's a RH system you're running on . Have you checked that you have the file linux/errno.h anywhere in your system? yes, but it wasnt around, errno.h was, but not errno.h like that So there's your problem :) i found the kernel-headers package, but it msut be damaged or something (rpm --query says it exists, but i have my doubts as to the files still existing) rpm -ql kernel-headers Would show you what files kernel-headers had installed. is it OK to install kernel headers of a diffirent kernel number? I don't know. But if you do try it, let us know what happens :) i.e. if i install kernel-headers 2.4.1 or wahtever is that ok? or will that cause problems? (im betting money on it will cause problems) If there aren't any special reasons, I would just use the corresponding headers for your kernel. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Silence is the only virtue you have left. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image generation Problems (jpeg)
Jason Wong wrote: On Monday 29 April 2002 21:40, Peter Revill wrote: Im not even sure myself, linux on 2.2.14 on what should be a redhat box i know theres a command something like dsmod to get the info, hmm.. Never mind, as long as you're reasonably sure it's a RH system you're running on . Its a colbat cube running some sort of modified linux, i think based on Redhat i doint know what kind of colbat cube Have you checked that you have the file linux/errno.h anywhere in your system? yes, but it wasnt around, errno.h was, but not errno.h like that So there's your problem :) Yer, i think that must be it i found the kernel-headers package, but it msut be damaged or something (rpm --query says it exists, but i have my doubts as to the files still existing) rpm -ql kernel-headers yep, returns kernel-headers-2.2.14C11-1 If there aren't any special reasons, I would just use the corresponding headers for your kernel. There is a special reason, namely: i cant find: kernel-headers-2.2.14C11-1.rpm anywhere :~( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image generation Problems (jpeg)
At 29.04.2002 15:24, you wrote: At 29.04.2002 20:02, you wrote: = PLEASE CC ALL AWNSERS TO [EMAIL PROTECTED] = hi, im having a few problems installing GD, ill start from the top: I need Jpeg support in my PHP installation, and unfortunatly, GD (the verison i have) does not support them, so i figure, ill install it, installing the libary jpeg-6b works easily however, i attempt to compile from there GD, but the following error is produced: [root gd-1.8.4]# make gcc -I. -I/usr/include/freetype2 -I/usr/include/X11 -I/usr/X11R6/include/X11 -I/usr/local/include -c -o gd_gd2.o gd_gd2.c In file included from /usr/include/errno.h:36, from gd_gd2.c:14: /usr/include/bits/errno.h:25: linux/errno.h: No such file or directory make: *** [gd_gd2.o] Error 1 I also tried recompiling PHP and got a similar error, which is very worrying, i think i might be missing some files Basically, waht i would really like, is a way to modify my CURRENT php config or my CURRENT gd config to take advantage of my shiny new jpeg libary, is there any method u can recommend to accomplish this? Thanks Peter = PLEASE CC ALL AWNSERS TO [EMAIL PROTECTED] == Check out the config file for gd, the path to the jpeg-6b must be included. There´s some problem of the order of the files, but there are more info in the config file. Also the path where the jpg libs are installed, is sometimes different, so you have to check them too. HTH Oliver TYPO Oops I meant makefile for gd instead of config file -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image generation Problems (jpeg)
On Monday 29 April 2002 21:55, Peter Revill wrote: Its a colbat cube running some sort of modified linux, i think based on Redhat i doint know what kind of colbat cube I presume you mean Colbalt ;-) in which case you cannot use the RH rpms. If there aren't any special reasons, I would just use the corresponding headers for your kernel. There is a special reason, namely: i cant find: kernel-headers-2.2.14C11-1.rpm anywhere :~( Well, you can try installing a newer kernel-headers, I don't know what effect it will have. Or your better bet is to upgrade the kernel as well. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Wouldn't this be a great world if being insecure and desperate were a turn-on? -- Broadcast News */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] image generation issues
when you say it doesn't work, do you mean that you get an error message or it just doesn't write the text to the image? -Original Message- From: Adrian Murphy [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 12, 2002 1:16 PM To: [EMAIL PROTECTED] Subject: [PHP] image generation issues Hi, I'm using the code in the manual to draw text on a png. but Its not working - ImageString() works but not ImageTTFText() I uploaded arial.ttf from windows to fonts/ folder Any Ideas: as a side note: PNG's - any real disadvantage to using them instead of gifs - not withstanding the compuserve issue and old browsers. the code button.php ?php Header (Content-type: image/png); $im = imagecreate (400, 30); $black = ImageColorAllocate ($im, 0, 0, 0); $white = ImageColorAllocate ($im, 255, 255, 255); ImageTTFText ($im, 20, 0, 10, 20, $white, fonts/arial.ttf,Testing... Omega: #937;); ImagePng ($im); ImageDestroy ($im); ? and i call it with img src=button.php border=0 alt=
Re: [PHP] image generation issues
Adrian, If you're using the code displayed, you need to use $im before you destroy it. If you want to deal with it as a .png then use: ImagePNG($im,some_name.png,100); and then pick up the file anytime using img src=some_name.png You can later remove it from the server using: unlink(some_name.png); hope this helps. Hugh - Original Message - From: Martin Towell [EMAIL PROTECTED] To: 'Adrian Murphy' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, February 11, 2002 6:36 PM Subject: RE: [PHP] image generation issues when you say it doesn't work, do you mean that you get an error message or it just doesn't write the text to the image? -Original Message- From: Adrian Murphy [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 12, 2002 1:16 PM To: [EMAIL PROTECTED] Subject: [PHP] image generation issues Hi, I'm using the code in the manual to draw text on a png. but Its not working - ImageString() works but not ImageTTFText() I uploaded arial.ttf from windows to fonts/ folder Any Ideas: as a side note: PNG's - any real disadvantage to using them instead of gifs - not withstanding the compuserve issue and old browsers. the code button.php ?php Header (Content-type: image/png); $im = imagecreate (400, 30); $black = ImageColorAllocate ($im, 0, 0, 0); $white = ImageColorAllocate ($im, 255, 255, 255); ImageTTFText ($im, 20, 0, 10, 20, $white, fonts/arial.ttf,Testing... Omega: #937;); ImagePng ($im); ImageDestroy ($im); ? and i call it with img src=button.php border=0 alt= -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image generation issues
i get 'Could not read font in..' i set permissions to 777 on both file and folder - Original Message - From: Martin Towell [EMAIL PROTECTED] To: 'Adrian Murphy' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, February 12, 2002 2:36 AM Subject: RE: [PHP] image generation issues when you say it doesn't work, do you mean that you get an error message or it just doesn't write the text to the image? -Original Message- From: Adrian Murphy [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 12, 2002 1:16 PM To: [EMAIL PROTECTED] Subject: [PHP] image generation issues Hi, I'm using the code in the manual to draw text on a png. but Its not working - ImageString() works but not ImageTTFText() I uploaded arial.ttf from windows to fonts/ folder Any Ideas: as a side note: PNG's - any real disadvantage to using them instead of gifs - not withstanding the compuserve issue and old browsers. the code button.php ?php Header (Content-type: image/png); $im = imagecreate (400, 30); $black = ImageColorAllocate ($im, 0, 0, 0); $white = ImageColorAllocate ($im, 255, 255, 255); ImageTTFText ($im, 20, 0, 10, 20, $white, fonts/arial.ttf,Testing... Omega: #937;); ImagePng ($im); ImageDestroy ($im); ? and i call it with img src=button.php border=0 alt= -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] image generation issues
unfortunately, the unix php version I've got access to doesn't have support for TTFs :( but the Windows box does - I have to specify the full path to the font - try that and see if that helps. -Original Message- From: Adrian Murphy [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 12, 2002 2:04 PM To: Martin Towell; [EMAIL PROTECTED] Subject: Re: [PHP] image generation issues i get 'Could not read font in..' i set permissions to 777 on both file and folder - Original Message - From: Martin Towell [EMAIL PROTECTED] To: 'Adrian Murphy' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, February 12, 2002 2:36 AM Subject: RE: [PHP] image generation issues when you say it doesn't work, do you mean that you get an error message or it just doesn't write the text to the image? -Original Message- From: Adrian Murphy [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 12, 2002 1:16 PM To: [EMAIL PROTECTED] Subject: [PHP] image generation issues Hi, I'm using the code in the manual to draw text on a png. but Its not working - ImageString() works but not ImageTTFText() I uploaded arial.ttf from windows to fonts/ folder Any Ideas: as a side note: PNG's - any real disadvantage to using them instead of gifs - not withstanding the compuserve issue and old browsers. the code button.php ?php Header (Content-type: image/png); $im = imagecreate (400, 30); $black = ImageColorAllocate ($im, 0, 0, 0); $white = ImageColorAllocate ($im, 255, 255, 255); ImageTTFText ($im, 20, 0, 10, 20, $white, fonts/arial.ttf,Testing... Omega: #937;); ImagePng ($im); ImageDestroy ($im); ? and i call it with img src=button.php border=0 alt=
Re: [PHP] image generation issues
tried everything suggested and still get 'could not read font' oh well thanx. - Original Message - From: hugh danaher [EMAIL PROTECTED] To: php [EMAIL PROTECTED] Sent: Tuesday, February 12, 2002 3:00 AM Subject: Re: [PHP] image generation issues Adrian, If you're using the code displayed, you need to use $im before you destroy it. If you want to deal with it as a .png then use: ImagePNG($im,some_name.png,100); and then pick up the file anytime using img src=some_name.png You can later remove it from the server using: unlink(some_name.png); hope this helps. Hugh - Original Message - From: Martin Towell [EMAIL PROTECTED] To: 'Adrian Murphy' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, February 11, 2002 6:36 PM Subject: RE: [PHP] image generation issues when you say it doesn't work, do you mean that you get an error message or it just doesn't write the text to the image? -Original Message- From: Adrian Murphy [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 12, 2002 1:16 PM To: [EMAIL PROTECTED] Subject: [PHP] image generation issues Hi, I'm using the code in the manual to draw text on a png. but Its not working - ImageString() works but not ImageTTFText() I uploaded arial.ttf from windows to fonts/ folder Any Ideas: as a side note: PNG's - any real disadvantage to using them instead of gifs - not withstanding the compuserve issue and old browsers. the code button.php ?php Header (Content-type: image/png); $im = imagecreate (400, 30); $black = ImageColorAllocate ($im, 0, 0, 0); $white = ImageColorAllocate ($im, 255, 255, 255); ImageTTFText ($im, 20, 0, 10, 20, $white, fonts/arial.ttf,Testing... Omega: #937;); ImagePng ($im); ImageDestroy ($im); ? and i call it with img src=button.php border=0 alt= -- 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 generation issues
Thanx for all the help.I discovered the STUPID little problem.my ftp software was set so it uploded .ttf in ascii instead of binary.all works now. thanks again - Original Message - From: Tom Rogers [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, February 12, 2002 3:38 AM Subject: Re: [PHP] image generation issues Hi Some of MS fonts wont work, try downloading some freeware fonts. Tom At 01:24 PM 2/12/02, Adrian Murphy wrote: tried everything suggested and still get 'could not read font' oh well thanx. - Original Message - From: hugh danaher [EMAIL PROTECTED] To: php [EMAIL PROTECTED] Sent: Tuesday, February 12, 2002 3:00 AM Subject: Re: [PHP] image generation issues Adrian, If you're using the code displayed, you need to use $im before you destroy it. If you want to deal with it as a .png then use: ImagePNG($im,some_name.png,100); and then pick up the file anytime using img src=some_name.png You can later remove it from the server using: unlink(some_name.png); hope this helps. Hugh - Original Message - From: Martin Towell [EMAIL PROTECTED] To: 'Adrian Murphy' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, February 11, 2002 6:36 PM Subject: RE: [PHP] image generation issues when you say it doesn't work, do you mean that you get an error message or it just doesn't write the text to the image? -Original Message- From: Adrian Murphy [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 12, 2002 1:16 PM To: [EMAIL PROTECTED] Subject: [PHP] image generation issues Hi, I'm using the code in the manual to draw text on a png. but Its not working - ImageString() works but not ImageTTFText() I uploaded arial.ttf from windows to fonts/ folder Any Ideas: as a side note: PNG's - any real disadvantage to using them instead of gifs - not withstanding the compuserve issue and old browsers. the code button.php ?php Header (Content-type: image/png); $im = imagecreate (400, 30); $black = ImageColorAllocate ($im, 0, 0, 0); $white = ImageColorAllocate ($im, 255, 255, 255); ImageTTFText ($im, 20, 0, 10, 20, $white, fonts/arial.ttf,Testing... Omega: #937;); ImagePng ($im); ImageDestroy ($im); ? and i call it with img src=button.php border=0 alt= -- 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 Generation Library
Hi, read the manual on the GD-library (www.php.net/image) it wont do any GIFS anymore, but it'll all the rest Bolke -Oorspronkelijk bericht- Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Verzonden: Wednesday, August 08, 2001 6:14 PM Aan: [EMAIL PROTECTED] Onderwerp: [PHP] Image Generation Library Hi to all, I need to create web pages containing images which should be updated periodically, but the image contents may vary as data coming from a database varies. What is that?, well the image will contain dynamic objects and static objects. The dynamic objects can be text (representing database data) and lines, where you can change attributes like color, position, etc. The static objects can be filled ellipses, circles, lines, static text. The image format can be a jpeg, gif or another type supported on html. Does somebody know some Library with functions for create such above images? Does somebody know some links to find something? I will apprecciate your attention to this. When you come to Mexico and Guadalajara City I will pay your help inviting you a bunch of Mexican Tacos. Atte. Ignacio Estrada F. Centro Nacional de Control de Energia Area de Control Occidental 025+6463, 025+6464, 025+646 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]