Re: [PHP] gd Graphics Library Question (EXIF)

2011-04-30 Thread Stuart Dallas
On Saturday, 30 April 2011 at 03:32, Mitch wrote:
I was wondering about that. Since I am not actually hosting my ISP would 
 have to have it loaded (or compiled into their PHP implementation), right?

You may be able to use http://php.net/dl to load the extension (you'll need to 
build it to be compatible with your host and then upload it) but it's highly 
unlikely they'll have the dl function enabled. Your best bet is to ask them to 
add it to their environment.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/



 On 4/29/2011 9:26 AM, Stuart Dallas wrote:
  On Friday, 29 April 2011 at 03:33, Mitch wrote:
  I have written a lightweight, easy to use photo album system in
   HTML/PHP/MySQL.In addition to the Photo Album side I have written a
   series of Admin Utilities to manage it with. One of the administrative
   utilities uploads photos from my local drive, resizes them to be more
   efficient on disk space, creates thumbnails and populates the database
   with as much default data as can be deduced.
   
   After all of this was written, I decided to see if I could pull EXIF
   data to supply some of the technical data for the DB. To my surprise,
   the only EXIF data in the JPEG files was data in the File, Computed and
   Comments sections.
   
   Why don't the gd utilities retain the original EXIF data? Is there any
   way to do so? I use the following gd utilities to resize and create the
   new JPEG image files:
   
   imagecreatefromjpeg
   imagesx
   imagesy
   imagercreatetruecolor
   imagecopyresized
   imagejpeg
  
  This is a known shortcoming of the GD library. You won't have that issue 
  with ImageMagick: http://php.net/book.imagick
  
  -Stuart
 
 
 -- 
 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] gd Graphics Library Question (EXIF)

2011-04-29 Thread Gerardo Benitez
Hi Mitch, you could try with
http://www.php.net/manual/en/function.exif-read-data.php

I did a test with image jpg and this was the result:
FILE . FileName: bruce_lee_black_white.jpgbr/
FILE . FileDateTime: 1304086298br/
FILE . FileSize: 33464br/
FILE . FileType: 2br/
FILE . MimeType: image/jpegbr/
FILE . SectionsFound: COMMENTbr/
COMPUTED . html: width=353 height=450br/
COMPUTED . Height: 450br/
COMPUTED . Width: 353br/
COMPUTED . IsColor: 1br/
COMMENT . 0: LEAD Technologies Inc. V1.01br/

Anyway taking account

*EXIF headers tend to be present in JPEG/TIFF images generated by digital
cameras, but unfortunately each digital camera maker has a different idea of
how to actually tag their images, so you can't always rely on a specific
Exif header being present. *

Regards.
Gerardo.





On Thu, Apr 28, 2011 at 11:33 PM, Mitch mit...@mme-ia.net wrote:

 I have written a lightweight, easy to use photo album system in
 HTML/PHP/MySQL.In addition to the Photo Album side I have written a series
 of Admin Utilities to manage it with. One of the administrative utilities
 uploads photos from my local drive, resizes them to be more efficient on
 disk space, creates thumbnails and populates the database with as much
 default data as can be deduced.

 After all of this was written, I decided to see if I could pull EXIF data
 to supply some of the technical data for the DB. To my surprise, the only
 EXIF data in the JPEG files was data in the File, Computed and Comments
 sections.

 Why don't the gd utilities retain the original EXIF data? Is there any way
 to do so? I use the following gd utilities to resize and create the new JPEG
 image files:

 imagecreatefromjpeg
 imagesx
 imagesy
 imagercreatetruecolor
 imagecopyresized
 imagejpeg

 Thanks in advance,
 Mitch

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Gerardo Benitez
-
www.webseficientes.com.ar
Diseño web, programación, Seo


Re: [PHP] gd Graphics Library Question (EXIF)

2011-04-29 Thread Stuart Dallas
On Friday, 29 April 2011 at 03:33, Mitch wrote:
I have written a lightweight, easy to use photo album system in 
 HTML/PHP/MySQL.In addition to the Photo Album side I have written a 
 series of Admin Utilities to manage it with. One of the administrative 
 utilities uploads photos from my local drive, resizes them to be more 
 efficient on disk space, creates thumbnails and populates the database 
 with as much default data as can be deduced.
 
 After all of this was written, I decided to see if I could pull EXIF 
 data to supply some of the technical data for the DB. To my surprise, 
 the only EXIF data in the JPEG files was data in the File, Computed and 
 Comments sections.
 
 Why don't the gd utilities retain the original EXIF data? Is there any 
 way to do so? I use the following gd utilities to resize and create the 
 new JPEG image files:
 
 imagecreatefromjpeg
 imagesx
 imagesy
 imagercreatetruecolor
 imagecopyresized
 imagejpeg

This is a known shortcoming of the GD library. You won't have that issue with 
ImageMagick: http://php.net/book.imagick

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] gd Graphics Library Question (EXIF)

2011-04-29 Thread Mitch
I was wondering about that. Since I am not actually hosting my ISP would 
have to have it loaded (or compiled into their PHP implementation), right?


I'll have to do some legwork with my ISP and ImageMagic

On 4/29/2011 9:26 AM, Stuart Dallas wrote:

On Friday, 29 April 2011 at 03:33, Mitch wrote:
I have written a lightweight, easy to use photo album system in

HTML/PHP/MySQL.In addition to the Photo Album side I have written a
series of Admin Utilities to manage it with. One of the administrative
utilities uploads photos from my local drive, resizes them to be more
efficient on disk space, creates thumbnails and populates the database
with as much default data as can be deduced.

After all of this was written, I decided to see if I could pull EXIF
data to supply some of the technical data for the DB. To my surprise,
the only EXIF data in the JPEG files was data in the File, Computed and
Comments sections.

Why don't the gd utilities retain the original EXIF data? Is there any
way to do so? I use the following gd utilities to resize and create the
new JPEG image files:

imagecreatefromjpeg
imagesx
imagesy
imagercreatetruecolor
imagecopyresized
imagejpeg


This is a known shortcoming of the GD library. You won't have that issue with 
ImageMagick: http://php.net/book.imagick

-Stuart




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD Watermark Question

2010-09-19 Thread Peter Lind
On 19 September 2010 16:05, tedd tedd.sperl...@gmail.com wrote:
 At 6:03 PM -0400 9/17/10, Gary wrote:

 Is there a way to insert a watermark on an image as it is being uploaded
 to
 the image file, then removed when it is called from a database to be
 viewed
 on a website?

 The rational behind this is I have a photographers site I am doing, and I
 am
 limiting the size of the images somewhat to reduce pilferage and I would
 like to be able to show the images a little larger, hence with a bit more
 clarity and detail.

 Thanks for your input.

 Gary

 Gary:

 Don't complicate this process more than necessary.

 Simply upload the image file normally and store it in the file system OR the
 database.

 When you want to show the image as a thumbnail, then show it. Here's the
 code:

 http://webbytedd.com/b/thumb/

 If you want to show it with a watermark, then show that. Again, here's the
 code:

 http://webbytedd.com/b/watermark/

 If you want to show the image as a thumbnail with a watermark, then combine
 the two routines. I'll leave that to you.


You're generating the thumbnail on every request. Just generate it
once and serve the thumbnail as a file (there's no reason why you
would need to invoke php to show a thumbnail of an image).
Regards
Peter

-- 
hype
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
BeWelcome/Couchsurfing: Fake51
Twitter: http://twitter.com/kafe15
/hype

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD Watermark Question

2010-09-17 Thread Ashley Sheridan
On Fri, 2010-09-17 at 18:03 -0400, Gary wrote:

 Is there a way to insert a watermark on an image as it is being uploaded to 
 the image file, then removed when it is called from a database to be viewed 
 on a website?
 
 The rational behind this is I have a photographers site I am doing, and I am 
 limiting the size of the images somewhat to reduce pilferage and I would 
 like to be able to show the images a little larger, hence with a bit more 
 clarity and detail.
 
 Thanks for your input.
 
 Gary 
 
 
 
 __ Information from ESET Smart Security, version of virus signature 
 database 5458 (20100917) __
 
 The message was checked by ESET Smart Security.
 
 http://www.eset.com
 
 
 
 
 


So where does the watermark get shown, because from what I can gather
from your description, it only exists on the image with the DB...

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] GD - import a PNG image and make transparant

2010-05-13 Thread tedd

At 6:40 PM -0500 5/12/10, Karl DeSaulniers wrote:

Hi Alex,
I have a php file I made just a few months ago.
It takes a gif, jpeg or png of any size and sizes it proportionately 
to a specified size and then outputs a png.
If the image is a transparent png or transparent gif, it will still 
hold the transparency.
This is just a test page and it tested ok for me, but it is my first 
one. I also tested it on PHP 5. Dont know about compatibility to 
older versions.

Knowing that, here you go.

http://designdrumm.com/upload_images_test.php.zip

HTH,

Karl



Bad link.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD - import a PNG image and make transparant

2010-05-13 Thread Karl DeSaulniers

Hey tedd,
Sorry bout that.. here you go.

http://designdrumm.com/upload_images_test.zip

Karl


On May 13, 2010, at 9:06 AM, tedd wrote:


At 6:40 PM -0500 5/12/10, Karl DeSaulniers wrote:

Hi Alex,
I have a php file I made just a few months ago.
It takes a gif, jpeg or png of any size and sizes it  
proportionately to a specified size and then outputs a png.
If the image is a transparent png or transparent gif, it will  
still hold the transparency.
This is just a test page and it tested ok for me, but it is my  
first one. I also tested it on PHP 5. Dont know about  
compatibility to older versions.

Knowing that, here you go.

http://designdrumm.com/upload_images_test.php.zip

HTH,

Karl



Bad link.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD - import a PNG image and make transparant

2010-05-13 Thread Alex Davies
Hi Ash,

Thanks for your suggestion. I think this is where my confusion is. I
understand how to use imagecolorallocatealpha() to for example create a 50%
transparant colour, and apply it to a new rectangle for example.

I dont understand how to apply it to a new source image, for example
$src = imagecreatefrompng('test.png');
// Something here (maybe  imagecolorallocatealpha()) to make this
50% transparent- either on its own, or make it 50% transparent as part of a
copy onto a new image

I had thought that imagecopymerge would help me with this, but it seems not.

I'm currently looking through Karl's example to see if I can work it out,
but if anyone can point out a super-simple way of achieving the pseudo-code
above, i'd be very grateful!

Cheers,

Alex

On Thu, May 13, 2010 at 1:34 AM, Ashley Sheridan
a...@ashleysheridan.co.ukwrote:

  On Thu, 2010-05-13 at 00:12 +0100, Alex Davies wrote:

 Hi,

 I am trying to import a PNG image from disk, place it on top of a
 transparant image created in GD and output it to the browser. In the case of
 a low opacity setting, I would expect to see the background colour from the
 HTML page.

 If I set the opacity to 0, everything works - I end up with a transparant
 image.

 However, if I set it for any value 0 (even 1) instead of  a
 very-faint-image the whole thing goes black. As the opacity level goes up
 from 0, the amount of black reduces and the amount of imported image
 increases - but this is not what I want.

 I am using this code:

 ?php
 $src = imagecreatefrompng('test.png');
 $img_width  = imagesx($src);
 $img_height = imagesy($src);

 // Create trans image
 $dest = imagecreatetruecolor($img_width, $img_height);
 //imagesavealpha($dest, true); // This has no effect it appears
 $trans_colour = imagecolorallocatealpha($dest, 0, 255, 0, 128);

 // Make the background transparent
 imagecolortransparent($dest, $trans_colour);
 //imagefill($dest, 0, 0, $trans_colour); // This does not work

 // Merge src on top of dest, with opacity of 1 in this case
 imagecopymerge($dest, $src, 0, 0, 0, 0, $img_width, $img_height, 1);

 // Output and free from memory
 header('Content-Type: image/png');
 imagepng($dest);
 ?

 The images that this outputs, at opacity levels 0,1 and 80 on a red and
 green background (screenshots of a HTML page) can be downloaded 
 fromhttp://www.box.net/shared/h9zn4tjgro

 Any help appreciated!

 Cheers,

 Alex


 How exactly are you setting the opacity for the image? The traditional way
 is to use imagecolorallocatealpha() on the source.

   Thanks,
 Ash
 http://www.ashleysheridan.co.uk





-- 
Alex Davies

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the sender immediately by e-mail and delete this e-mail permanently.


Re: [PHP] GD - import a PNG image and make transparant

2010-05-12 Thread Karl DeSaulniers

Hi Alex,
I have a php file I made just a few months ago.
It takes a gif, jpeg or png of any size and sizes it proportionately  
to a specified size and then outputs a png.
If the image is a transparent png or transparent gif, it will still  
hold the transparency.
This is just a test page and it tested ok for me, but it is my first  
one. I also tested it on PHP 5. Dont know about compatibility to  
older versions.

Knowing that, here you go.

http://designdrumm.com/upload_images_test.php.zip

HTH,

Karl


On May 12, 2010, at 6:12 PM, Alex Davies wrote:


Hi,

I am trying to import a PNG image from disk, place it on top of a
transparant image created in GD and output it to the browser. In  
the case of
a low opacity setting, I would expect to see the background colour  
from the

HTML page.

If I set the opacity to 0, everything works - I end up with a  
transparant

image.

However, if I set it for any value 0 (even 1) instead of  a
very-faint-image the whole thing goes black. As the opacity level  
goes up

from 0, the amount of black reduces and the amount of imported image
increases - but this is not what I want.

I am using this code:

?php
$src = imagecreatefrompng('test.png');
$img_width  = imagesx($src);
$img_height = imagesy($src);

// Create trans image
$dest = imagecreatetruecolor($img_width, $img_height);
//imagesavealpha($dest, true); // This has no effect it appears
$trans_colour = imagecolorallocatealpha($dest, 0, 255, 0, 128);

// Make the background transparent
imagecolortransparent($dest, $trans_colour);
//imagefill($dest, 0, 0, $trans_colour); // This does not work

// Merge src on top of dest, with opacity of 1 in this case
imagecopymerge($dest, $src, 0, 0, 0, 0, $img_width, $img_height, 1);

// Output and free from memory
header('Content-Type: image/png');
imagepng($dest);
?

The images that this outputs, at opacity levels 0,1 and 80 on a red  
and

green background (screenshots of a HTML page) can be downloaded from
http://www.box.net/shared/h9zn4tjgro

Any help appreciated!

Cheers,

Alex


Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD - import a PNG image and make transparant

2010-05-12 Thread Ashley Sheridan
On Thu, 2010-05-13 at 00:12 +0100, Alex Davies wrote:

 Hi,
 
 I am trying to import a PNG image from disk, place it on top of a
 transparant image created in GD and output it to the browser. In the case of
 a low opacity setting, I would expect to see the background colour from the
 HTML page.
 
 If I set the opacity to 0, everything works - I end up with a transparant
 image.
 
 However, if I set it for any value 0 (even 1) instead of  a
 very-faint-image the whole thing goes black. As the opacity level goes up
 from 0, the amount of black reduces and the amount of imported image
 increases - but this is not what I want.
 
 I am using this code:
 
 ?php
 $src = imagecreatefrompng('test.png');
 $img_width  = imagesx($src);
 $img_height = imagesy($src);
 
 // Create trans image
 $dest = imagecreatetruecolor($img_width, $img_height);
 //imagesavealpha($dest, true); // This has no effect it appears
 $trans_colour = imagecolorallocatealpha($dest, 0, 255, 0, 128);
 
 // Make the background transparent
 imagecolortransparent($dest, $trans_colour);
 //imagefill($dest, 0, 0, $trans_colour); // This does not work
 
 // Merge src on top of dest, with opacity of 1 in this case
 imagecopymerge($dest, $src, 0, 0, 0, 0, $img_width, $img_height, 1);
 
 // Output and free from memory
 header('Content-Type: image/png');
 imagepng($dest);
 ?
 
 The images that this outputs, at opacity levels 0,1 and 80 on a red and
 green background (screenshots of a HTML page) can be downloaded from
 http://www.box.net/shared/h9zn4tjgro
 
 Any help appreciated!
 
 Cheers,
 
 Alex


How exactly are you setting the opacity for the image? The traditional
way is to use imagecolorallocatealpha() on the source.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] [GD] Image errors

2009-07-15 Thread Peter Ford
Ash, Martin,

Seems you are both wandering around the obvious problem...

I suspect that $tipo (in the next line) is *supposed* to be $type - sounds like
a partial Italian translation to me...

So given that $type=imagecreatefrompng (for example, if the mime check returns
'png' - not very reliable, I suspect),

then

$immagine = $type($this-updir.$id.'.png')

should create a GD resource from the file, but the image appears to be empty.

My take on this is:

OP says he gets the same result from
$immagine = imagecreatefromjpeg(this-updir.$id.'.png')

- well I might expect to get an error message if I loaded a PNG expecting it to
be a JPEG, but I certainly wouldn't expect an image.

On some basic tests, I find that mime_content_type() is not defined on my
system, so ignoring that and trying to load a PNG file using imagecreatefromjpeg
results in pretty much the same result as the OP...

Conclusions:

First: if you use Italian for your variable names, don't change half of their
instances to English...

Second: Make sure you actually know the mime type of a file before you try to
load it into GD...

My version of this would test against known image types to try the GD function:

foreach (Array('png','jpeg','gif') as $typeName)
{
  $type = 'imagecreatefrom'.$typeName;
  $immagine = $type(this-updir.$id.'.png'le);
  if (is_resource($immagine))
  {
header('Content-type: image/jpeg');
imagejpeg($immagine,null,100);
imagedestroy($immagine);
break;
  }
}
header('HTTP/1.0 500 File is not an allowed image type');





-- 
Peter Ford  phone: 01580 89
Developer   fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [GD] Image errors

2009-07-15 Thread Peter Ford
Martin Scotta wrote:
 Why are you ussing GD?
 All you need is output the image to the browser?
 
 try this... I didn't test/run this code, but it may work...
 
 public function showPicture( $id ) {
   header('Content-type:' . mime_content_type( $this-updir . $id .
 '.png' ) );
   readfile( $this-updir . $id . '.png' );
   }
 
 hey, look, just 2 lines!
 
But it doesn't convert the image from whatever came in to a JPEG output, which
is what the OP's code appears to be trying to do (and possibly ought to work...)



-- 
Peter Ford  phone: 01580 89
Developer   fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [GD] Image errors

2009-07-14 Thread Martin Scotta
$immagine = $tipo($this-updir.$id.'.png');

$tipo is undefined


On Tue, Jul 14, 2009 at 12:48 PM, Il pinguino
volantetuxs...@codeinside.it wrote:
 Hi to all

 I get a problem processing an image with GD libraries.

 This is my function

   public function showPicture($id) {
       header('Content-type: image/jpeg');
       $mime = mime_content_type($this-updir.$id.'.png');
       $type = explode('/',$mime);
       $type = 'imagecreatefrom'.$type[1];
       $immagine = $tipo($this-updir.$id.'.png');
       imagejpeg($immagine,null,100);
       imagedestroy($immagine);
   }

 If i commentize the header function i get a lot of strange simbols (such
 as the code of a jpeg image!) but no errors.
 The result of this code is a blank page. In Firefox the title sets to
 picture.php (JPEG image) and if i right-click it and click on
 Proprieties i get 0px × 0px (resized as 315px × 19px).

 P.S.: I get the same result when I write $immagine =
 imagecreatefromjpeg(...)

 (Sorry for my english)

 Thanks in advance,
 Alfio.

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





-- 
Martin Scotta

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [GD] Image errors

2009-07-14 Thread Ashley Sheridan
On Tue, 2009-07-14 at 13:27 -0300, Martin Scotta wrote:
 $immagine = $tipo($this-updir.$id.'.png');
 
 $tipo is undefined
 
 
 On Tue, Jul 14, 2009 at 12:48 PM, Il pinguino
 volantetuxs...@codeinside.it wrote:
  Hi to all
 
  I get a problem processing an image with GD libraries.
 
  This is my function
 
public function showPicture($id) {
header('Content-type: image/jpeg');
$mime = mime_content_type($this-updir.$id.'.png');
$type = explode('/',$mime);
$type = 'imagecreatefrom'.$type[1];
$immagine = $tipo($this-updir.$id.'.png');
imagejpeg($immagine,null,100);
imagedestroy($immagine);
}
 
  If i commentize the header function i get a lot of strange simbols (such
  as the code of a jpeg image!) but no errors.
  The result of this code is a blank page. In Firefox the title sets to
  picture.php (JPEG image) and if i right-click it and click on
  Proprieties i get 0px × 0px (resized as 315px × 19px).
 
  P.S.: I get the same result when I write $immagine =
  imagecreatefromjpeg(...)
 
  (Sorry for my english)
 
  Thanks in advance,
  Alfio.
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 
 -- 
 Martin Scotta
 
Also, it doesn't look like you're actually doing anything with $type

Thanks
Ash
www.ashleysheridan.co.uk


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [GD] Image errors

2009-07-14 Thread Martin Scotta
He is calling the function by variable

something like this

$func = 'var_dump';

$func( new Foo );

On Tue, Jul 14, 2009 at 1:30 PM, Ashley
Sheridana...@ashleysheridan.co.uk wrote:
 On Tue, 2009-07-14 at 13:27 -0300, Martin Scotta wrote:
 $immagine = $tipo($this-updir.$id.'.png');

 $tipo is undefined


 On Tue, Jul 14, 2009 at 12:48 PM, Il pinguino
 volantetuxs...@codeinside.it wrote:
  Hi to all
 
  I get a problem processing an image with GD libraries.
 
  This is my function
 
    public function showPicture($id) {
        header('Content-type: image/jpeg');
        $mime = mime_content_type($this-updir.$id.'.png');
        $type = explode('/',$mime);
        $type = 'imagecreatefrom'.$type[1];
        $immagine = $tipo($this-updir.$id.'.png');
        imagejpeg($immagine,null,100);
        imagedestroy($immagine);
    }
 
  If i commentize the header function i get a lot of strange simbols (such
  as the code of a jpeg image!) but no errors.
  The result of this code is a blank page. In Firefox the title sets to
  picture.php (JPEG image) and if i right-click it and click on
  Proprieties i get 0px × 0px (resized as 315px × 19px).
 
  P.S.: I get the same result when I write $immagine =
  imagecreatefromjpeg(...)
 
  (Sorry for my english)
 
  Thanks in advance,
  Alfio.
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 



 --
 Martin Scotta

 Also, it doesn't look like you're actually doing anything with $type

 Thanks
 Ash
 www.ashleysheridan.co.uk





-- 
Martin Scotta

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [GD] Image errors

2009-07-14 Thread Ashley Sheridan
On Tue, 2009-07-14 at 13:41 -0300, Martin Scotta wrote:
 He is calling the function by variable
 
 something like this
 
 $func = 'var_dump';
 
 $func( new Foo );
 
 On Tue, Jul 14, 2009 at 1:30 PM, Ashley
 Sheridana...@ashleysheridan.co.uk wrote:
  On Tue, 2009-07-14 at 13:27 -0300, Martin Scotta wrote:
  $immagine = $tipo($this-updir.$id.'.png');
 
  $tipo is undefined
 
 
  On Tue, Jul 14, 2009 at 12:48 PM, Il pinguino
  volantetuxs...@codeinside.it wrote:
   Hi to all
  
   I get a problem processing an image with GD libraries.
  
   This is my function
  
 public function showPicture($id) {
 header('Content-type: image/jpeg');
 $mime = mime_content_type($this-updir.$id.'.png');
 $type = explode('/',$mime);
 $type = 'imagecreatefrom'.$type[1];
 $immagine = $tipo($this-updir.$id.'.png');
 imagejpeg($immagine,null,100);
 imagedestroy($immagine);
 }
  
   If i commentize the header function i get a lot of strange simbols 
   (such
   as the code of a jpeg image!) but no errors.
   The result of this code is a blank page. In Firefox the title sets to
   picture.php (JPEG image) and if i right-click it and click on
   Proprieties i get 0px × 0px (resized as 315px × 19px).
  
   P.S.: I get the same result when I write $immagine =
   imagecreatefromjpeg(...)
  
   (Sorry for my english)
  
   Thanks in advance,
   Alfio.
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  
 
 
 
  --
  Martin Scotta
 
  Also, it doesn't look like you're actually doing anything with $type
 
  Thanks
  Ash
  www.ashleysheridan.co.uk
 
 
 
 
 
 -- 
 Martin Scotta
 

Bottom post ;)

$type = explode('/',$mime);
$type = 'imagecreatefrom'.$type[1];

$immagine = $tipo($this-updir.$id.'.png');
imagejpeg($immagine,null,100);
imagedestroy($immagine);

I'm not sure you understood what I meant. line 2 above $type is assigned
to the string 'imagecreatefrom'.$type[1];

Now I assume that was to be used later in some sort of eval() statement,
but its never called again, so the line really does nothing.

Thanks
Ash
www.ashleysheridan.co.uk


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [GD] Image errors

2009-07-14 Thread Martin Scotta
On Tue, Jul 14, 2009 at 1:48 PM, Ashley
Sheridana...@ashleysheridan.co.uk wrote:
 On Tue, 2009-07-14 at 13:41 -0300, Martin Scotta wrote:
 He is calling the function by variable

 something like this

 $func = 'var_dump';

 $func( new Foo );

 On Tue, Jul 14, 2009 at 1:30 PM, Ashley
 Sheridana...@ashleysheridan.co.uk wrote:
  On Tue, 2009-07-14 at 13:27 -0300, Martin Scotta wrote:
  $immagine = $tipo($this-updir.$id.'.png');
 
  $tipo is undefined
 
 
  On Tue, Jul 14, 2009 at 12:48 PM, Il pinguino
  volantetuxs...@codeinside.it wrote:
   Hi to all
  
   I get a problem processing an image with GD libraries.
  
   This is my function
  
     public function showPicture($id) {
         header('Content-type: image/jpeg');
         $mime = mime_content_type($this-updir.$id.'.png');
         $type = explode('/',$mime);
         $type = 'imagecreatefrom'.$type[1];
         $immagine = $tipo($this-updir.$id.'.png');
         imagejpeg($immagine,null,100);
         imagedestroy($immagine);
     }
  
   If i commentize the header function i get a lot of strange simbols 
   (such
   as the code of a jpeg image!) but no errors.
   The result of this code is a blank page. In Firefox the title sets to
   picture.php (JPEG image) and if i right-click it and click on
   Proprieties i get 0px × 0px (resized as 315px × 19px).
  
   P.S.: I get the same result when I write $immagine =
   imagecreatefromjpeg(...)
  
   (Sorry for my english)
  
   Thanks in advance,
   Alfio.
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  
 
 
 
  --
  Martin Scotta
 
  Also, it doesn't look like you're actually doing anything with $type
 
  Thanks
  Ash
  www.ashleysheridan.co.uk
 
 



 --
 Martin Scotta


 Bottom post ;)

 $type = explode('/',$mime);
 $type = 'imagecreatefrom'.$type[1];

 $immagine = $tipo($this-updir.$id.'.png');
 imagejpeg($immagine,null,100);
 imagedestroy($immagine);

 I'm not sure you understood what I meant. line 2 above $type is assigned
 to the string 'imagecreatefrom'.$type[1];

 Now I assume that was to be used later in some sort of eval() statement,
 but its never called again, so the line really does nothing.

 Thanks
 Ash
 www.ashleysheridan.co.uk



Mmmm, No

$type = explode('/',$mime); # type is array
$type = 'imagecreatefrom'.$type[1]; # type is a string

He is actually re-assigning the var ussing the content of the var.
Sounds crazy, but I use this method a lot, it helps to keep the scope clean.

-- 
Martin Scotta
ps. tipo is type in Spanish

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [GD] Image errors

2009-07-14 Thread Ashley Sheridan
On Tue, 2009-07-14 at 14:16 -0300, Martin Scotta wrote:
 On Tue, Jul 14, 2009 at 1:48 PM, Ashley
 Sheridana...@ashleysheridan.co.uk wrote:
  On Tue, 2009-07-14 at 13:41 -0300, Martin Scotta wrote:
  He is calling the function by variable
 
  something like this
 
  $func = 'var_dump';
 
  $func( new Foo );
 
  On Tue, Jul 14, 2009 at 1:30 PM, Ashley
  Sheridana...@ashleysheridan.co.uk wrote:
   On Tue, 2009-07-14 at 13:27 -0300, Martin Scotta wrote:
   $immagine = $tipo($this-updir.$id.'.png');
  
   $tipo is undefined
  
  
   On Tue, Jul 14, 2009 at 12:48 PM, Il pinguino
   volantetuxs...@codeinside.it wrote:
Hi to all
   
I get a problem processing an image with GD libraries.
   
This is my function
   
  public function showPicture($id) {
  header('Content-type: image/jpeg');
  $mime = mime_content_type($this-updir.$id.'.png');
  $type = explode('/',$mime);
  $type = 'imagecreatefrom'.$type[1];
  $immagine = $tipo($this-updir.$id.'.png');
  imagejpeg($immagine,null,100);
  imagedestroy($immagine);
  }
   
If i commentize the header function i get a lot of strange simbols 
(such
as the code of a jpeg image!) but no errors.
The result of this code is a blank page. In Firefox the title sets to
picture.php (JPEG image) and if i right-click it and click on
Proprieties i get 0px × 0px (resized as 315px × 19px).
   
P.S.: I get the same result when I write $immagine =
imagecreatefromjpeg(...)
   
(Sorry for my english)
   
Thanks in advance,
Alfio.
   
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
   
   
  
  
  
   --
   Martin Scotta
  
   Also, it doesn't look like you're actually doing anything with $type
  
   Thanks
   Ash
   www.ashleysheridan.co.uk
  
  
 
 
 
  --
  Martin Scotta
 
 
  Bottom post ;)
 
  $type = explode('/',$mime);
  $type = 'imagecreatefrom'.$type[1];
 
  $immagine = $tipo($this-updir.$id.'.png');
  imagejpeg($immagine,null,100);
  imagedestroy($immagine);
 
  I'm not sure you understood what I meant. line 2 above $type is assigned
  to the string 'imagecreatefrom'.$type[1];
 
  Now I assume that was to be used later in some sort of eval() statement,
  but its never called again, so the line really does nothing.
 
  Thanks
  Ash
  www.ashleysheridan.co.uk
 
 
 
 Mmmm, No
 
 $type = explode('/',$mime); # type is array
 $type = 'imagecreatefrom'.$type[1]; # type is a string
 
 He is actually re-assigning the var ussing the content of the var.
 Sounds crazy, but I use this method a lot, it helps to keep the scope clean.
 

It's not crazy, I do it a lot, but he *does nothing with it* after that,
and the scope of the variable is limited to the function.

Thanks
Ash
www.ashleysheridan.co.uk


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [GD] Image errors

2009-07-14 Thread Martin Scotta
Why are you ussing GD?
All you need is output the image to the browser?

try this... I didn't test/run this code, but it may work...

public function showPicture( $id ) {
  header('Content-type:' . mime_content_type( $this-updir . $id .
'.png' ) );
  readfile( $this-updir . $id . '.png' );
  }

hey, look, just 2 lines!

On Tue, Jul 14, 2009 at 2:20 PM, Ashley
Sheridana...@ashleysheridan.co.uk wrote:
 On Tue, 2009-07-14 at 14:16 -0300, Martin Scotta wrote:
 On Tue, Jul 14, 2009 at 1:48 PM, Ashley
 Sheridana...@ashleysheridan.co.uk wrote:
  On Tue, 2009-07-14 at 13:41 -0300, Martin Scotta wrote:
  He is calling the function by variable
 
  something like this
 
  $func = 'var_dump';
 
  $func( new Foo );
 
  On Tue, Jul 14, 2009 at 1:30 PM, Ashley
  Sheridana...@ashleysheridan.co.uk wrote:
   On Tue, 2009-07-14 at 13:27 -0300, Martin Scotta wrote:
   $immagine = $tipo($this-updir.$id.'.png');
  
   $tipo is undefined
  
  
   On Tue, Jul 14, 2009 at 12:48 PM, Il pinguino
   volantetuxs...@codeinside.it wrote:
Hi to all
   
I get a problem processing an image with GD libraries.
   
This is my function
   
  public function showPicture($id) {
      header('Content-type: image/jpeg');
      $mime = mime_content_type($this-updir.$id.'.png');
      $type = explode('/',$mime);
      $type = 'imagecreatefrom'.$type[1];
      $immagine = $tipo($this-updir.$id.'.png');
      imagejpeg($immagine,null,100);
      imagedestroy($immagine);
  }
   
If i commentize the header function i get a lot of strange simbols 
(such
as the code of a jpeg image!) but no errors.
The result of this code is a blank page. In Firefox the title sets to
picture.php (JPEG image) and if i right-click it and click on
Proprieties i get 0px × 0px (resized as 315px × 19px).
   
P.S.: I get the same result when I write $immagine =
imagecreatefromjpeg(...)
   
(Sorry for my english)
   
Thanks in advance,
Alfio.
   
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
   
   
  
  
  
   --
   Martin Scotta
  
   Also, it doesn't look like you're actually doing anything with $type
  
   Thanks
   Ash
   www.ashleysheridan.co.uk
  
  
 
 
 
  --
  Martin Scotta
 
 
  Bottom post ;)
 
  $type = explode('/',$mime);
  $type = 'imagecreatefrom'.$type[1];
 
  $immagine = $tipo($this-updir.$id.'.png');
  imagejpeg($immagine,null,100);
  imagedestroy($immagine);
 
  I'm not sure you understood what I meant. line 2 above $type is assigned
  to the string 'imagecreatefrom'.$type[1];
 
  Now I assume that was to be used later in some sort of eval() statement,
  but its never called again, so the line really does nothing.
 
  Thanks
  Ash
  www.ashleysheridan.co.uk
 
 

 Mmmm, No

 $type = explode('/',$mime); # type is array
 $type = 'imagecreatefrom'.$type[1]; # type is a string

 He is actually re-assigning the var ussing the content of the var.
 Sounds crazy, but I use this method a lot, it helps to keep the scope clean.


 It's not crazy, I do it a lot, but he *does nothing with it* after that,
 and the scope of the variable is limited to the function.

 Thanks
 Ash
 www.ashleysheridan.co.uk





-- 
Martin Scotta

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD and Converting a Transparent PNG-8 to a Transparent GIF

2009-01-18 Thread Jochem Maas
Graham Anderson schreef:
 Hi
 
 I am having problems getting GD to convert a transparent PNG-8 to a
 transparent GIF
 The below WILL produce a GIF...but leaves a white background
 
 # Convert the PreExisting PNG Image to a GIF
 $img = imagecreatefrompng($pngPath);
 
 # Set the GIF to be transparent: Does not seem to work
 $trans_color = imagecolortransparent($img );
  $trans_index = imagecolorallocate($img, $trans_color['red'],
 $trans_color['green'], $trans_color['blue'] );
  imagecolortransparent($img, $trans_index );

I can't see the above code doing much useful. the problem is somewhat
more involved, png uses an alpha channel to determine how much transparency
a given pixel has, with gif a pixel is either transparent or not, essentially
a given colour in the gif's palette is marked as transparent and all
pixels with that color are therefore shown as transparent.

try the code here (no idea how well it works):

http://demo.pixelsandpages.com/php-tests/images/test.html

and/or dig into the user comments here:

http://php.net/imagecolortransparent


 # Save the Image as a GIF in the directory
 imagegif($img, $gifAbsolutePath);
 
 
 Is there another way that works?
 
 Many thanks in advance
 
 G
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD and Converting a Transparent PNG-8 to a Transparent GIF

2009-01-18 Thread Graham Anderson

Thanks for the reply

I tried the example (below) from the link and still get a gif with  
white background.  Maybe, you can only do this with PNG-24s...not  
PNG-8s?

Anyone else know if this can work?


# Convert the PreExisting PNG Image to a GIF
$img = imagecreatefrompng($pngPath);

$gifAbsolutePath = PROJECT_ROOT_DIR.'/'.$gifDir.'/'.$gif;   


$transparentColor = imagecolorallocate($img, 0xfe, 0x3, 0xf4 );
//$ditherHistory = array(); //stores number of times it was transparent
$height = imagesy($img);
$width = imagesx($img);

for($x = 0; $x  $width; $x++):
for($y = 0; $y  $height; $y++):
$alpha = (imagecolorat($img,$x,$y)  0x7F00)  24;//127 is  
completely TRANSPARENT, 0 opaque

//DITHER!
if($alpha3(
$alpha =127-3 ||
(rand(0,127))=(127-$alpha)
)){
imagesetpixel($img,$x,$y,$transparentColor);
}

endfor;
endfor;

imagecolortransparent($img, $transparentColor);

# Save the Image as a GIF in the directory $gifDir
imagegif($img, $gifAbsolutePath);

imagedestroy($img);


On Jan 18, 2009, at 4:46 PM, Jochem Maas wrote:


Graham Anderson schreef:

Hi

I am having problems getting GD to convert a transparent PNG-8 to a
transparent GIF
The below WILL produce a GIF...but leaves a white background

# Convert the PreExisting PNG Image to a GIF
$img = imagecreatefrompng($pngPath);

# Set the GIF to be transparent: Does not seem to work
$trans_color = imagecolortransparent($img );
$trans_index = imagecolorallocate($img, $trans_color['red'],
$trans_color['green'], $trans_color['blue'] );
imagecolortransparent($img, $trans_index );


I can't see the above code doing much useful. the problem is somewhat
more involved, png uses an alpha channel to determine how much  
transparency
a given pixel has, with gif a pixel is either transparent or not,  
essentially

a given colour in the gif's palette is marked as transparent and all
pixels with that color are therefore shown as transparent.

try the code here (no idea how well it works):

http://demo.pixelsandpages.com/php-tests/images/test.html

and/or dig into the user comments here:

http://php.net/imagecolortransparent



# Save the Image as a GIF in the directory
imagegif($img, $gifAbsolutePath);


Is there another way that works?

Many thanks in advance

G






--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD and Converting a Transparent PNG-8 to a Transparent GIF

2009-01-18 Thread Graham Anderson

I got it to work :)
Like you had recommended, I found a script in http://php.net/imagecolortransparent 
 from: fmkaiba at optonline dot net

07-Feb-2008 08:05.  The function is called, createthumb

Cheers
Graham

On Jan 18, 2009, at 4:46 PM, Jochem Maas wrote:


Graham Anderson schreef:

Hi

I am having problems getting GD to convert a transparent PNG-8 to a
transparent GIF
The below WILL produce a GIF...but leaves a white background

# Convert the PreExisting PNG Image to a GIF
$img = imagecreatefrompng($pngPath);

# Set the GIF to be transparent: Does not seem to work
$trans_color = imagecolortransparent($img );
$trans_index = imagecolorallocate($img, $trans_color['red'],
$trans_color['green'], $trans_color['blue'] );
imagecolortransparent($img, $trans_index );


I can't see the above code doing much useful. the problem is somewhat
more involved, png uses an alpha channel to determine how much  
transparency
a given pixel has, with gif a pixel is either transparent or not,  
essentially

a given colour in the gif's palette is marked as transparent and all
pixels with that color are therefore shown as transparent.

try the code here (no idea how well it works):

http://demo.pixelsandpages.com/php-tests/images/test.html

and/or dig into the user comments here:

http://php.net/imagecolortransparent



# Save the Image as a GIF in the directory
imagegif($img, $gifAbsolutePath);


Is there another way that works?

Many thanks in advance

G






--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD - Print Animated GIF

2008-06-19 Thread Per Jessen
Stephen Pynenburg wrote:

 Hey All,
 I'm new to the list, but hopefully it's a nice one :)
 Anyway, my problem is fairly straightforward, but there doesn't seem
 to be anything on it anywhere. When I read an animated GIF with
 imagecreatefromgif(), then print it out with imagegif(), the result is
 just the first frame of the animation.

Hi Stephen

see http://www.libgd.org/FAQ_PHP :

please note that PHP has not yet been updated to include support 
for the animated GIF features that have been added to gd. It will be
added in php 5.3 and 6.x


/Per Jessen, Zürich


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD brush tracing letters

2008-06-14 Thread Daniel Brown
On Sun, Dec 16, 2007 at 7:16 PM, eric cash [EMAIL PROTECTED] wrote:
 Quick GD question, I'm building a custom CAPTCHA, and I want to 'trace'
 random letters (hopefully from a random font) with a brush. Is there an easy
 way to do this, or am I going to have to build some ridiculous custom
 library on my own to do it?  Thanks!

You'll need to ask that on a GD list.  It's not PHP-related.

http://www.libgd.org/Support

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD - JPEG to PNG with transparency and color

2008-05-07 Thread tedd

At 12:16 PM -0400 5/6/08, Travis L. Font wrote:

Following files:
bg.png - Clear Transparent Image
14416fed5d4f78.jpg - Normal Jpeg Image


The Code:

header('content-type: image/png');

$watermark = imagecreatefromjpeg('14416fed5d4f78.jpg');

$watermark_width = imagesx($watermark);
$watermark_height = imagesy($watermark);

$image = imagecreatetruecolor($watermark_width, $watermark_height);
$image = imagecreatefrompng('bg.png');

$size = getimagesize('bg.png');

$dest_x = $size[0] - $watermark_width - 5;
$dest_y = $size[1] - $watermark_height - 5;

imagecopymerge($image, $watermark, $dest_x, 
$dest_y, 0, 0, $watermark_width, 
$watermark_height, 100);


imagepng($image);

imagedestroy($image);
imagedestroy($watermark);


The Problem:

The code above works fine in sense of syntax! 
bg.png acts as a transparent border for 
14416fed5d4f78.jpg to keep the size of bg.png 
and not the size of 14416fed5d4f78.jpg so it 
doesn't blow up 14416fed5d4f78.jpg. However, the 
image comes out black/white and has lost its 
color!
I looked all over Google and I've found nothing 
so far that's functional to give the new created 
png file the correct colors as the original 
14416fed5d4f78.jpg. I figure that I'm missing 
some small elements to the process of creating 
the pngŠ
Anyone have any ideas, pointers, advice, or 
correct solution to make this possible?


Travis:

Try this:

$original=imagecreatefromjpeg(mydog.jpg);
$watermark=imagecreatefrompng(copyright.png);

$osx=imagesx($original);
$osy=imagesy($original);
$wsx=imagesx($watermark);
$wsy=imagesy($watermark);

imagecopy($original, $watermark, ($osx-$wsx)/2, 
($osy-$wsy)/2, 0, 0, $wsx, $wsy); //center


imagepng($original, trans.png);

The code works here:

http://webbytedd.com/b/watermark/

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

Re: [PHP] GD, changing an images pixel color, color matching, fuzzy picture

2008-03-28 Thread Casey

On Mar 28, 2008, at 4:27 PM, Lamonte [EMAIL PROTECTED] wrote:

Okay I created a script that changes a basic smiley face into a red  
smiley face..but it doesn't replace all the yellow, it looks like a  
yellow shadow in the background:


?php
$image = smiley.png;
$data = getimagesize($image);
$width = intval($data[0]);
$height = intval($data[1]);
$cloneH = 0;
$hex = FF;
$oldhex = FCFF00;
$im = imagecreatefrompng($image);
$color = imagecolorallocate($im,hexdec(substr($hex,0,2)),hexdec 
(substr($hex,2,2)),hexdec(substr($hex,4,6)));

for($cloneH=0;$cloneH$height;$cloneH++)
{
  for($x=0;$x$width;$x++)
  {
  if( colormatch($im,$x,$cloneH, $oldhex) )
  imagesetpixel($im, $x, $cloneH, $color);
  }   }
header(Content-Type: {$data['mime']});
imagepng($im);
function colormatch($image,$x,$y,$hex)
{
  $rgb = imagecolorat($image,$x,$y);
  $r = ($rgb  16)  0xFF;
  $g = ($rgb  8)  0xFF;
  $b = $rgb  0xFF;
$r2 = hexdec(substr($hex,0,2));
  $g2 = hexdec(substr($hex,2,2));
  $b2 = hexdec(substr($hex,4,6));
  if( $r == $r2  $b == $b2  $g == $g2 )
  return true;
  return false;
  //echo $r $r2, $g $g2, $b $b2;
}
?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Hi!

I have absolutely no clue if this will work. This has been typed  
directly into my mail client, so no guarantees.


?php
 function toRGB($color) {
  return array('r' = ($color  16)  0xFF, 'g' = ($color  8)   
0xFF, 'b' = $color  0xFF);

 }

 function toColor($r, $g, $b) {
  return $r * $g * $b;
 }

 $image = 'smiley.png';
 list($w, $h) = getimagesize($image);
 $im = imagecreatefrompng($image);

 for ($y = 0; $y  $h; $y++) {
  for ($x = 0; $x  $w; $x++) {
   extract(toRGB(imagecolorat($im, $x, $y)));
   if ($r = 0xCC  $g = 0xCC  $b = 0x33)
imagesetpixel($im, $x, $y, toColor(($r + $g) / 2, 0, $b));
  }
 }

 header('Content-type: image/png');
 imagepng($im);
?

:)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD, changing an images pixel color, color matching, fuzzy picture

2008-03-28 Thread Casey

I have an annoying habit of not using comments :)

Explanations are inline.

On Mar 28, 2008, at 7:10 PM, Lamonte [EMAIL PROTECTED] wrote:


Casey wrote:

On Mar 28, 2008, at 4:27 PM, Lamonte [EMAIL PROTECTED] wrote:

Okay I created a script that changes a basic smiley face into a  
red smiley face..but it doesn't replace all the yellow, it looks  
like a yellow shadow in the background:


?php
$image = smiley.png;
$data = getimagesize($image);
$width = intval($data[0]);
$height = intval($data[1]);
$cloneH = 0;
$hex = FF;
$oldhex = FCFF00;
$im = imagecreatefrompng($image);
$color = imagecolorallocate($im,hexdec(substr($hex,0,2)),hexdec 
(substr($hex,2,2)),hexdec(substr($hex,4,6)));

for($cloneH=0;$cloneH$height;$cloneH++)
{
 for($x=0;$x$width;$x++)
 {
 if( colormatch($im,$x,$cloneH, $oldhex) )
 imagesetpixel($im, $x, $cloneH, $color);
 }   }
header(Content-Type: {$data['mime']});
imagepng($im);
function colormatch($image,$x,$y,$hex)
{
 $rgb = imagecolorat($image,$x,$y);
 $r = ($rgb  16)  0xFF;
 $g = ($rgb  8)  0xFF;
 $b = $rgb  0xFF;
   $r2 = hexdec(substr($hex,0,2));
 $g2 = hexdec(substr($hex,2,2));
 $b2 = hexdec(substr($hex,4,6));
 if( $r == $r2  $b == $b2  $g == $g2 )
 return true;
 return false;
 //echo $r $r2, $g $g2, $b $b2;
}
?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Hi!

I have absolutely no clue if this will work. This has been typed  
directly into my mail client, so no guarantees.


?php
function toRGB($color) {
 return array('r' = ($color  16)  0xFF, 'g' = ($color  8)   
0xFF, 'b' = $color  0xFF);

}
This function returns an array of red, green, and blue from an integer  
like 0xFF.



function toColor($r, $g, $b) {
 return $r * $g * $b;
}
This function is basically the opposite of the above. (the integer  
value from red, green, and blue)



$image = 'smiley.png';
list($w, $h) = getimagesize($image);
$im = imagecreatefrompng($image);

for ($y = 0; $y  $h; $y++) {
 for ($x = 0; $x  $w; $x++) {

Loop through the pixels.


  extract(toRGB(imagecolorat($im, $x, $y)));
Take the values from the array return of toRGB so we can use $r, $g,  
and $b instead of $array['r'], etc.


  if ($r = 0xCC  $g = 0xCC  $b = 0x33)
After some trial and error (looking at color charts), any red  CC,  
green  CC, and blue  33 is some shade of yellow.


   imagesetpixel($im, $x, $y, toColor(($r + $g) / 2, 0, $b));
The expression inside toColor() is my attempt to calculate the correct  
shade  of red from the shade of yellow.


 }
}

header('Content-type: image/png');
imagepng($im);
?

:)

I don't understand half of that, can you explain what you did? (it  
works) I was more trying to fix my problem then recoding the whole  
thing though.

I hope that helps.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD, changing an images pixel color, color matching, fuzzy picture

2008-03-28 Thread Casey

On Mar 28, 2008, at 7:38 PM, Lamonte [EMAIL PROTECTED] wrote:


Casey wrote:

I have an annoying habit of not using comments :)

Explanations are inline.

On Mar 28, 2008, at 7:10 PM, Lamonte [EMAIL PROTECTED] wrote:


Casey wrote:

On Mar 28, 2008, at 4:27 PM, Lamonte [EMAIL PROTECTED] wrote:

Okay I created a script that changes a basic smiley face into a  
red smiley face..but it doesn't replace all the yellow, it looks  
like a yellow shadow in the background:


?php
$image = smiley.png;
$data = getimagesize($image);
$width = intval($data[0]);
$height = intval($data[1]);
$cloneH = 0;
$hex = FF;
$oldhex = FCFF00;
$im = imagecreatefrompng($image);
$color = imagecolorallocate($im,hexdec(substr($hex,0,2)),hexdec 
(substr($hex,2,2)),hexdec(substr($hex,4,6)));

for($cloneH=0;$cloneH$height;$cloneH++)
{
for($x=0;$x$width;$x++)
{
if( colormatch($im,$x,$cloneH, $oldhex) )
imagesetpixel($im, $x, $cloneH, $color);
}   }
header(Content-Type: {$data['mime']});
imagepng($im);
function colormatch($image,$x,$y,$hex)
{
$rgb = imagecolorat($image,$x,$y);
$r = ($rgb  16)  0xFF;
$g = ($rgb  8)  0xFF;
$b = $rgb  0xFF;
  $r2 = hexdec(substr($hex,0,2));
$g2 = hexdec(substr($hex,2,2));
$b2 = hexdec(substr($hex,4,6));
if( $r == $r2  $b == $b2  $g == $g2 )
return true;
return false;
//echo $r $r2, $g $g2, $b $b2;
}
?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Hi!

I have absolutely no clue if this will work. This has been typed  
directly into my mail client, so no guarantees.


?php
function toRGB($color) {
return array('r' = ($color  16)  0xFF, 'g' = ($color  8)   
0xFF, 'b' = $color  0xFF);

}
This function returns an array of red, green, and blue from an  
integer like 0xFF.



function toColor($r, $g, $b) {
return $r * $g * $b;
}
This function is basically the opposite of the above. (the integer  
value from red, green, and blue)



$image = 'smiley.png';
list($w, $h) = getimagesize($image);
$im = imagecreatefrompng($image);

for ($y = 0; $y  $h; $y++) {
for ($x = 0; $x  $w; $x++) {

Loop through the pixels.


 extract(toRGB(imagecolorat($im, $x, $y)));
Take the values from the array return of toRGB so we can use $r,  
$g, and $b instead of $array['r'], etc.


 if ($r = 0xCC  $g = 0xCC  $b = 0x33)
After some trial and error (looking at color charts), any red  CC,  
green  CC, and blue  33 is some shade of yellow.


  imagesetpixel($im, $x, $y, toColor(($r + $g) / 2, 0, $b));
The expression inside toColor() is my attempt to calculate the  
correct shade  of red from the shade of yellow.


}
}

header('Content-type: image/png');
imagepng($im);
?

:)

I don't understand half of that, can you explain what you did? (it  
works) I was more trying to fix my problem then recoding the  
whole thing though.

I hope that helps.


The thing is, it returns black. not red.
Oh. Replace the toColor function with the imagecolorallocate function  
and add $im as the first parameter.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD / Pixel Font Rendering

2008-03-17 Thread Jochem Maas

nihilism machine schreef:
I am trying to render an 8 pixel pixel font without anti aliasing to 
look crisp (silkscreen) in 8pt with gd. the font is huge and ugly:


?php
// Set the content-type
header(Content-type: image/png);

// Create the image
$im = imagecreatetruecolor(400, 30);

// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 399, 29, $white);

// The text to draw
$text = 'Testing...';
// Replace path by your own font path
$font = 'silkscreen.ttf';

// Add some shadow to the text
imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);

// Add the text
imagettftext($im, 20, 0, 10, 20, $black, $font, $text);

// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
?


-- any ideas?


don't post twice.
use '8' instead of '20' for the fontsize.






--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD / Pixel Font Rendering

2008-03-17 Thread Børge Holen
On Monday 17 March 2008 09:25:36 Jochem Maas wrote:
 nihilism machine schreef:
  I am trying to render an 8 pixel pixel font without anti aliasing to
  look crisp (silkscreen) in 8pt with gd. the font is huge and ugly:
 
  ?php
  // Set the content-type
  header(Content-type: image/png);
 
  // Create the image
  $im = imagecreatetruecolor(400, 30);
 
  // Create some colors
  $white = imagecolorallocate($im, 255, 255, 255);
  $grey = imagecolorallocate($im, 128, 128, 128);
  $black = imagecolorallocate($im, 0, 0, 0);
  imagefilledrectangle($im, 0, 0, 399, 29, $white);
 
  // The text to draw
  $text = 'Testing...';
  // Replace path by your own font path
  $font = 'silkscreen.ttf';
 
  // Add some shadow to the text
  imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);
 
  // Add the text
  imagettftext($im, 20, 0, 10, 20, $black, $font, $text);
 
  // Using imagepng() results in clearer text compared with imagejpeg()
  imagepng($im);
  imagedestroy($im);
  ?
 
 
  -- any ideas?

 don't post twice.

I recon he didn't.
This list has the tendancy to send double posts from time to time.

 use '8' instead of '20' for the fontsize.



-- 
---
Børge Holen
http://www.arivene.net

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD / Pixel Font Rendering

2008-03-17 Thread Jochem Maas

Børge Holen schreef:

On Monday 17 March 2008 09:25:36 Jochem Maas wrote:

nihilism machine schreef:

I am trying to render an 8 pixel pixel font without anti aliasing to
look crisp (silkscreen) in 8pt with gd. the font is huge and ugly:

?php
// Set the content-type
header(Content-type: image/png);

// Create the image
$im = imagecreatetruecolor(400, 30);

// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 399, 29, $white);

// The text to draw
$text = 'Testing...';
// Replace path by your own font path
$font = 'silkscreen.ttf';

// Add some shadow to the text
imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);

// Add the text
imagettftext($im, 20, 0, 10, 20, $black, $font, $text);

// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
?


-- any ideas?

don't post twice.


I recon he didn't.


maybe, maybe not. I get punished for stuff I didn't do all the time ... why 
shouldn't he ;-)


This list has the tendancy to send double posts from time to time.


it does? haven't noticed that. I'll be more vigilant (well I'll try)




use '8' instead of '20' for the fontsize.







--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD / Pixel Font Rendering

2008-03-17 Thread Børge Holen
On Monday 17 March 2008 13:10:20 Jochem Maas wrote:
 Børge Holen schreef:
  On Monday 17 March 2008 09:25:36 Jochem Maas wrote:
  nihilism machine schreef:
  I am trying to render an 8 pixel pixel font without anti aliasing to
  look crisp (silkscreen) in 8pt with gd. the font is huge and ugly:
 
  ?php
  // Set the content-type
  header(Content-type: image/png);
 
  // Create the image
  $im = imagecreatetruecolor(400, 30);
 
  // Create some colors
  $white = imagecolorallocate($im, 255, 255, 255);
  $grey = imagecolorallocate($im, 128, 128, 128);
  $black = imagecolorallocate($im, 0, 0, 0);
  imagefilledrectangle($im, 0, 0, 399, 29, $white);
 
  // The text to draw
  $text = 'Testing...';
  // Replace path by your own font path
  $font = 'silkscreen.ttf';
 
  // Add some shadow to the text
  imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);
 
  // Add the text
  imagettftext($im, 20, 0, 10, 20, $black, $font, $text);
 
  // Using imagepng() results in clearer text compared with imagejpeg()
  imagepng($im);
  imagedestroy($im);
  ?
 
 
  -- any ideas?
 
  don't post twice.
 
  I recon he didn't.

 maybe, maybe not. I get punished for stuff I didn't do all the time ... why
 shouldn't he ;-)

THAT on the other hand is a perfectly good reason to kick the shit out of 
someone =D


  This list has the tendancy to send double posts from time to time.

 it does? haven't noticed that. I'll be more vigilant (well I'll try)

  use '8' instead of '20' for the fontsize.



-- 
---
Børge Holen
http://www.arivene.net

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD Library

2007-10-31 Thread Jochem Maas
Charlene wrote:
 I have the GD Library installed, but I don't see any of the fonts.  What
 is the preferred location to download fonts (standard fonts like Arial,
 Verdana, etc.) and which directory should they be stored in?

'standard fonts' is not. and any directory you want. upload any legal fonts
you have/need.

http://php.net/manual/en/function.imagettftext.php

... pass it in the fullpath to the .tff file (amongst other things)

 
 Charlene
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] GD Library

2007-09-13 Thread Jay Blanchard
[snip]
I am running PHP 4.4.7 without the GD Library and need it to run.
I am very novice on PHP, and am using a Mac with 10.3.9.
Can anyone point me in the right direction?
[/snip]

http://www.php.net/gd tells you how to get and install the libraries.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD Library

2007-09-13 Thread Greg Donald
On Thu, 13 Sep 2007, Steve Marquez wrote:
 I am running PHP 4.4.7 without the GD Library and need it to run.
 I am very novice on PHP, and am using a Mac with 10.3.9.
 Can anyone point me in the right direction?


http://destiney.com/blog/php-4-5-macos-x

Hopefully those configs aren't totally outdated.


-- 
Greg Donald
Cyberfusion Consulting
http://cyberfusionconsulting.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD Library

2007-09-13 Thread Samuel Vogel

I would point you to MAMP:
http://www.mamp.info/

It's like Xampp but designed all for a Mac... Easy to install, to 
configure and to user ;)


Regards,
Samy

Greg Donald schrieb:

On Thu, 13 Sep 2007, Steve Marquez wrote:
 

I am running PHP 4.4.7 without the GD Library and need it to run.
I am very novice on PHP, and am using a Mac with 10.3.9.
Can anyone point me in the right direction?




http://destiney.com/blog/php-4-5-macos-x

Hopefully those configs aren't totally outdated.


  


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD Library and outputing image

2007-06-15 Thread tedd

At 9:17 PM +0100 6/13/07, Ross wrote:

Never really used the GD much before very straightforward but how do I
output the image on a page. This is  fine on a php page on its own but what
about one where the headers are already sent?


Ross:

That's not a problem. See this:

http://xn--nvg.com/rotated_text  -- if your browser chokes, get a 
better browser


The image code (text.php) is:

?php
Header (Content-type: image/gif);
$im = imagecreate (150, 150);
$background = ImageColorAllocate ($im, 238, 238, 238);
$text_color = ImageColorAllocate ($im, 00, 51, 102);//#036 00 33 66 HEX
ImageTTFText ($im, 20, 45, 30, 130, $text_color, arial.ttf,
  Hello World...);
ImageGif ($im);
ImageDestroy ($im);
?

and it's called from html like this:

img src=text.php

If you put this into your site, you'll need arial.tff to make it 
work, but you can find it in lot's of places.


Cheers,

tedd


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD Library and outputing image

2007-06-13 Thread Daniel Brown

On 6/13/07, Ross [EMAIL PROTECTED] wrote:

Never really used the GD much before very straightforward but how do I
output the image on a page. This is  fine on a php page on its own but what
about one where the headers are already sent?


I take it I can do something like  this img
scr=get_image.php?url=$img_url/a. Anyone got a better method?




$image = imagecreatefromjpeg($img_url);
if ($image === false) { die ('Unable to open image'); }

// Get original width and height
echo $width = imagesx($image);
echo $height = imagesy($image);

// New width and height
$new_width = 200;
$new_height = 150;

// Resample
$image_resized = imagecreatetruecolor($new_width, $new_height);
imagecopyresampled($image_resized, $image, 0, 0, 0, 0, $new_width,
$new_height, $width, $height);

// Display resized image
header('Content-type: image/jpeg');
imagejpeg($image_resized);
die();

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




   Aside from perhaps changing die(); to exit;, though not necessary,
I'd say that it looks like you're right on track.  Until you find a
better way to have HTML display an image than through IMG SRC=..., I
think it's good to go.

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD Library and outputing image

2007-06-13 Thread Stephen


Ross [EMAIL PROTECTED] wrote:Never really used the GD much before very 
straightforward but how do I 
output the image on a page. This is fine on a php page on its own but what 
about one where the headers are already sent?
   
  Save the image as file, first.
   
  The href src= etc


Re: [PHP] GD Library and outputing image

2007-06-13 Thread Daniel Brown

On 6/13/07, Stephen [EMAIL PROTECTED] wrote:



Ross [EMAIL PROTECTED] wrote:Never really used the GD much before very 
straightforward but how do I
output the image on a page. This is fine on a php page on its own but what
about one where the headers are already sent?

  Save the image as file, first.

  The href src= etc



   If space isn't an issue, that's an alternative answer

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] GD 2.0.28 + PHP 4.4.2 + pixelation :(

2006-12-27 Thread Peter Lauri
Hi,

imagecopyresampled might help you... I use that and it works without
problems.

/Peter

-Original Message-
From: Steven Macintyre [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 27, 2006 10:17 AM
To: php-general@lists.php.net
Subject: [PHP] GD 2.0.28 + PHP 4.4.2 + pixelation :(

Hi All,

I have done some searching via google and some answers say change
copyimageresampled to copyimageresized etc 

I have tried all fixes ... to no avail


I have one image here 1280 x 960 (150 dpi) 24 depth

When using the following it pixelates ... 

function createthumb($name,$filename,$new_w,$new_h)
{
$system=explode(.,$name);
$src_img=imagecreatefromjpeg($name);
$old_x=imageSX($src_img);
$old_y=imageSY($src_img);
if ($old_x  $old_y)
{
$thumb_w=$new_w;
$thumb_h=$old_y*($new_h/$old_x);
}
if ($old_x  $old_y)
{
$thumb_w=$old_x*($new_w/$old_y);
$thumb_h=$new_h;
}
if ($old_x == $old_y)
{
$thumb_w=$new_w;
$thumb_h=$new_h;
}
$dst_img=ImageCreateTrueColor($thumb_w,$thumb_h);

imagecopyresized($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);
imagejpeg($dst_img,$filename);
imagedestroy($dst_img);
imagedestroy($src_img);
}

Which I am of course calling with
createthumb($add,'../pics/'.$largeval,350,263);

Now ... afaik my new sizes are proportional to the big ones ... but it
pixelates :(

However,

Using an image 1600 x 1200 (96 dpi) 24 depth it works and there is no
pixilation

Can someone perhaps assist now?


  
Kind Regards,


Steven Macintyre
http://steven.macintyre.name
--

http://www.friends4friends.co.za

-- 
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] GD 2.0.28 + PHP 4.4.2 + pixelation :(

2006-12-27 Thread Jochem Maas
Steven Macintyre wrote:
 Hi All,
 
 I have done some searching via google and some answers say change
 copyimageresampled to copyimageresized etc 

which should be the correct; use copyimageresampled()

 
 I have tried all fixes ... to no avail
 
 
 I have one image here 1280 x 960 (150 dpi) 24 depth

DPI is completely irrelevant.

the '24 depth' sounds like your using a PNG as input rather
that a JPEG (which your function expects)

your not making sure that the new width  height are always
integers. use intval() or ceil() or floor() (depending on your
your and the context)... I have no idea what happens if you pass
floats (or non-numeric data) in the relevant arguments of image*()
functinons but I'm guessing it *could* lead to unexplained weirdness
of some sort.

read the man page for imagejpeg():

http://php.net/manual/en/function.imagejpeg.php

take note of the third argument, personally I always set it to 100,
anything less and clients have a tendency to start complaining about image
quality.


 
 When using the following it pixelates ... 
 
 function createthumb($name,$filename,$new_w,$new_h)
 {
   $system=explode(.,$name);
   $src_img=imagecreatefromjpeg($name);
   $old_x=imageSX($src_img);
   $old_y=imageSY($src_img);
   if ($old_x  $old_y)
   {
   $thumb_w=$new_w;
   $thumb_h=$old_y*($new_h/$old_x);
   }
   if ($old_x  $old_y)
   {
   $thumb_w=$old_x*($new_w/$old_y);
   $thumb_h=$new_h;
   }
   if ($old_x == $old_y)
   {
   $thumb_w=$new_w;
   $thumb_h=$new_h;
   }
   $dst_img=ImageCreateTrueColor($thumb_w,$thumb_h);
   
 imagecopyresized($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);

try: imagecopyresampled();

   imagejpeg($dst_img,$filename);
   imagedestroy($dst_img);
   imagedestroy($src_img);
 }
 
 Which I am of course calling with
 createthumb($add,'../pics/'.$largeval,350,263);
 
 Now ... afaik my new sizes are proportional to the big ones ... but it
 pixelates :(
 
 However,
 
 Using an image 1600 x 1200 (96 dpi) 24 depth it works and there is no
 pixilation
 
 Can someone perhaps assist now?
 
 
 
 Kind Regards,
 
 
 Steven Macintyre
 http://steven.macintyre.name
 --
 
 http://www.friends4friends.co.za
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] GD 2.0.28 + PHP 4.4.2 + pixelation :(

2006-12-27 Thread Steven Macintyre
 imagecopyresampled might help you... I use that and it works
 without
 problems.
 

Hi Peter,

 I have done some searching via google and some answers say change
copyimageresampled to copyimageresized etc

I have tried your suggestion with the same results ... that is what I was
using first :(

S

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] GD, and GD JPEG

2006-11-26 Thread Peter Lauri
I don't know what environment you are on, because I have been absent from
this list a long while. If you are on a Linux distribution you might be able
to do this via the command line:

yum install php-gd.i386

service httpd restart

That might install GD and then restart the web server.

/Peter



-Original Message-
From: sublimenal [mailto:[EMAIL PROTECTED] 
Sent: Sunday, November 26, 2006 6:31 AM
To: php-general@lists.php.net
Subject: Re: [PHP] GD, and GD JPEG


Hey you need to ./configure it into your php installation via the command
line

Jeff-153 wrote:
 
 
   Hi there.
 I installed a script but it requires GD and GD JPEG
 
 I downloaded GD, and GD JPEG
 
 But how the heck do I install it?
 
 Thanks guys
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 

-- 
View this message in context:
http://www.nabble.com/GD%2C-and-GD-JPEG-tf2705080.html#a7543299
Sent from the PHP - General mailing list archive at Nabble.com.

-- 
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] GD.. con't

2006-11-25 Thread Richard Lynch
On Sat, November 25, 2006 4:25 pm, Jeff wrote:
 Do I have to compile it with a C program?

You do not need to compile GD on Windows, unless you are a masochist. :-v

Use http://php.net/phpinfo to find out where you php.ini file is, or
should be.

Whatever directory that shows for php.ini, put your php.ini file there.

Then edit it and find the line about php_gd.dll, or something like
that), and un-comment it by removing the ';' at the beginning.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD, and GD JPEG

2006-11-25 Thread sublimenal

Hey you need to ./configure it into your php installation via the command
line

Jeff-153 wrote:
 
 
   Hi there.
 I installed a script but it requires GD and GD JPEG
 
 I downloaded GD, and GD JPEG
 
 But how the heck do I install it?
 
 Thanks guys
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 

-- 
View this message in context: 
http://www.nabble.com/GD%2C-and-GD-JPEG-tf2705080.html#a7543299
Sent from the PHP - General mailing list archive at Nabble.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD - Problem writing text

2006-11-24 Thread Richard Lynch
On Thu, November 23, 2006 9:30 am, Fredrik Thunberg wrote:
 imagettftext  ($im, 30,  0, 10, 40 , $black, TTF_DIR. times.ttf,
 Hello World!);

 FreeType Support enabled
 FreeType Linkage with freetype
 FreeType Version 2.1.3

 The one things that differs between the servers is:
 FreeType Linkagewith TTF library is set on the faulty one.
 Can
 this be the problem?

It sure seems suspicious to me.

Not that I can ever keep straight all those different font packages,
but  maybe you need that other other TTF library font format instead
of times.ttf to be installed on the non-working machine...

The only other thing would be to double-check that PHP actually can
find and read the full path to your times.ttf file, to be SURE it's
not paths/permissions getting you.

Oh.  Also try to compare any FreeType configuration files on both
machines.  I seem to recall there was some kind of config file... No,
that was the pdflib.upr file I was thinking of...  Still, any kind of
test/configuration check you can run on the font installations may
help.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] gd for php5 under RH ES4

2006-10-11 Thread Richard Lynch
On Wed, October 11, 2006 1:36 pm, Doug Fulton wrote:
 I am trying to use the php gd library (for imagecreate, etc) with php5
 under Red Hat ES4.  I tried installing php-gd via webmin (which in
 turn,
 I see, uses up2date), but get the following error in the apache error
 log when restarting:
 PHP Warning:  PHP Startup: Unable to load dynamic library
 '/usr/lib/php4/gd.so' - /usr/lib/php4/gd.so: undefined symbol:
 empty_string in Unknown on line 0

 I don't know if the problem is that php-gd is a php4 library or there
 is
 something else that I need to install or do.  I saw something about
 php5-gd, but webmin/up2date can't find anything by this name.

 I have searched for a bit on this without joy; any guidance is
 appreciated.  I am not a system administrator by training, but am a
 longtime Unix programmer, so I can handle reasonably low level
 instructions, if necessary.  I did post this to a Red Hat list without
 any reply so far.

The way I see it, you have 2 choices:

#1. Convince webmin and/or up2date and/or RedHat to fix their broken
installer dependencies.

#2. Compile the PHP GD extension, and GD itself probably, from source.

Actually, you could dink around some more with up2date to be sure you
have GD itself installed first -- That might be the problem, and would
be trivial to fix.

There are 3 pieces to this puzzle that you must install and also match
up version-wise:
GD
PHP
PHP GD extension

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] GD to database directly

2006-07-19 Thread Jay Blanchard
[snip]
... some research ...
[/snip]

So, am I to assume that this issue about storing images in databases is
dead? 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] GD to database directly

2006-07-19 Thread tedd
At 12:36 PM -0500 7/19/06, Jay Blanchard wrote:
[snip]
... some research ...
[/snip]

So, am I to assume that this issue about storing images in databases is
dead?

Yes, it was dead before it started, as it was the last time this issue was 
discussed.

Simply put, there are tradeoffs, but both sides are so entrenched in their 
beliefs that they find it difficult to acknowledge that.

So, as I did, try both and figure out what works for you.

tedd
-- 

http://sperling.com  http://ancientstones.com  http://earthstones.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] GD to database directly

2006-07-18 Thread Jay Blanchard
[snip]
Kevin, you have more than once pointed out using a RAW format for
operating the data system, what exactly do you mean? The database
becomes the OS? If so, how do you set that up? It is something that I am
not totally familiar with. 
[/snip]

I did some research and went back to Kevin's original statement;

[kevin]
databases can be stored on RAW partitions, thus eliminating FILE SYSTEM
overhead
[/kevin]

Here is what I found;

[quote]
raw partition vs filesystem store? 

 What are pros/cons as far as performance, reliability, and ease of 
 backup/restore? 
 
 Anyone have any experience running Innodb on raw partition? 

raw partitions are beneficial only in some old OS/hardware
configurations 
where fsync is extremely slow. In most computers, you only get a  5 % 
performance improvement from raw partitions. 

 Any thoughts as to best filesystem for Innodb? What about pros/cons of

 journaled filesystems when in use with Innodb (i.e. transactions)? 

All major Linux file systems seem to have almost the same performance. 
[/quote - Heikki Tuuri]

Use of MySQL on a RAW partition I limited to InnoDB type; (note the use
of 'may' in the quote)

[quote]
http://dev.mysql.com/doc/refman/5.0/en/innodb-raw-devices.html

You can use raw disk partitions as data files in the shared tablespace.
By using a raw disk, you can perform non-buffered I/O on Windows and on
some Unix systems without filesystem overhead, which may improve
performance.
[/quote]

[quote]
A raw device can be bound to an existing block device (e.g. a disk) and
be used to perform raw IO with that existing block device. Such raw
IO bypasses the caching that is normally associated with block devices.
Hence a raw device offers a more direct route to the physical device
and allows an application more control over the timing of IO to that
physical device. This makes raw devices suitable for complex
applications like Database Management Systems that typically do their
own caching. 
[/quote - SCSI HOWTO]

Based on what I read utilizing a RAW would probably require most PHP'ers
to reconfigure their systems in major ways, including the database type,
disk partitions, etc. I don't know about you, but most would consider
Heikki Tuuri an expert on MySQL systems and Tuuri's thoughts indicate
that RAW partitions vs. file systems are a wash unless you have fsync
problems. It would appear that the only benefit comes from not having
the file system doing the caching.

[previous statement]
There are a lot of us using MySQL (and PostGreSQL) along with PHP and in
practice we have found that storing images in the database to be less
than ideal from both a performance and backup POV. The reasons range
from speed to overhead to ease of use. On our hardware. It not only has
to do with storing and retrieving BLOB data, but also things like
indexing, OS qwirks and the like.
[/previous statement]

I still stand by this, and amend by saying that using a RAW partition
for database storage is typically beyond the needs of most PHP'ers as it
gains nothing in performance and requires that much additional
maintenance be performed on the database as well as the OS for
maintenance of the RAW partition.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD to database directly

2006-07-16 Thread Lester Caine

Richard Lynch wrote:


Given the number of posts here in PHP-General alone, of people getting
tripped up by these things, I have concluded that cramming images into
the DB is far more trouble than it is worth.

It *seems* like a Good Idea until you actually do it for awhile, and
then run into all these snags.


Oddly enough, I have never run into them. Nor has terraserver which stores
hundreds of thousands of images in its db, although not mysql.


You may well have the needed skill set.

Alas, the sheer number of problem posts here would indicate that that
skillset is not the norm.

I'll stop advising against images in the DB when you answer all the
posts here from the problems it causes. :-)


Given the right database, then posting raw data to it is not a problem. 
I would not classify MySQL as one that one would use or that.


Personally I still use the rather crude database called Windows to store 
binary data and live with the backup and crash problems that involves. 
Simply because the customers have insisted, and signed to accept that 
they know the problems - even after showing how much more stable Linux 
is for the server!


At the end of the day, binary data is stored on the disk. Whether it is 
stored in a 'proper' BLOB page set with an id in the related record or 
direct on the disk with the file name in the record, it still has to be 
accessed from the disk in order to use it. None of the existing 
OS/Database options provide the ideal solution and it is that which 
needs fixing :) - perhaps in another 100 years when Windows has been 
replaced with a real operating system ;)


--
Lester Caine - G8HFL
-
L.S.Caine Electronic Services - http://home.lsces.co.uk
Model Engineers Digital Workshop - 
http://home.lsces.co.uk/ModelEngineersDigitalWorkshop/

Treasurer - Firebird Foundation Inc. - http://www.firebirdsql.org/index.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD to database directly

2006-07-16 Thread Kevin Waterson
This one time, at band camp, Richard Lynch [EMAIL PROTECTED] wrote:
 
 Assume, for the sake of argument, that your hard drive crashed.
 
 And your backup tape was invalid.
 
 And the weekly backup tape is also invalid.
 
 And, for good measuere, the monthly tape is just so out-of-date, that
 recovering from the crashed hard drive actually looks like an
 attractive option.
In this scenario, it would not matter where your images were stored, however
it would be a simple matter of hot swapping one of the raid drives.

  LONGBLOB
 
 Not big enough.

4GB is big enough for any sane image

Kind regards
Kevin

-- 
Democracy is two wolves and a lamb voting on what to have for lunch. 
Liberty is a well-armed lamb contesting the vote.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] GD to database directly

2006-07-16 Thread Jay Blanchard
[snip]
...a lot of stuff started by my original answer...
[/snip]

While this has been a fine debate I find that the discussion has
deteriorated badly. Can we bring it back on point?

There are a lot of us using MySQL (and PostGreSQL) along with PHP and in
practice we have found that storing images in the database to be less
than ideal from both a performance and backup POV. The reasons range
from speed to overhead to ease of use. On our hardware. It not only has
to do with storing and retrieving BLOB data, but also things like
indexing, OS qwirks and the like.

Kevin, you have more than once pointed out using a RAW format for
operating the data system, what exactly do you mean? The database
becomes the OS? If so, how do you set that up? It is something that I am
not totally familiar with. If you are talking about RAW photo data I am
familiar with that.

As far as backup, I have a routine that backs up my databases AND the
images, PDF's, DOC's, and other binary file format items that the data
system points to. That wasn't hard to set up, and it is very reliable. I
never have a problem with integrity.

And finally, benchmarking. There would be three benchmarks to be
conducted and concerned with here, as I have stated before;

PHP and images in the OS's file system
PHP and images in the MySQL database
PHP and images in the OS's file system pointed to by data stored in the
MySQL database.

Usually only two are compared.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD to database directly

2006-07-15 Thread Richard Lynch
On Fri, July 14, 2006 9:52 pm, Kevin Waterson wrote:


 I'm more concerned about the disaster recovery of a DB from a
 crashed
 hard drive, which has been cluttered up with binary data, making
 data
 recovery.

 One of the greatest benifits of binary DB storage is a single point
 of back up
 mysqldump db_name  backup.sql -u username -p
 It really is as simple as that and no need to bother about referential
 integrity when rebuilding, simple
 mysql db_name  back.sql -u username -p

 How much easier does it get?

Assume, for the sake of argument, that your hard drive crashed.

And your backup tape was invalid.

And the weekly backup tape is also invalid.

And, for good measuere, the monthly tape is just so out-of-date, that
recovering from the crashed hard drive actually looks like an
attractive option.

Your images will make this final last stand not viable.

 Then your field storage size has to be large enough.

 LONGBLOB

Not big enough.

If it *WAS* big enough, we wouldn't have the posts here asking why
their monster image didn't work in their database, and got corrupted.

 Given the number of posts here in PHP-General alone, of people
 getting
 tripped up by these things, I have concluded that cramming images
 into
 the DB is far more trouble than it is worth.

 It *seems* like a Good Idea until you actually do it for awhile, and
 then run into all these snags.

 Oddly enough, I have never run into them. Nor has terraserver which
 stores
 hundreds of thousands of images in its db, although not mysql.

You may well have the needed skill set.

Alas, the sheer number of problem posts here would indicate that that
skillset is not the norm.

I'll stop advising against images in the DB when you answer all the
posts here from the problems it causes. :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD to database directly

2006-07-14 Thread Richard Lynch
On Thu, July 13, 2006 6:49 pm, Kevin Waterson wrote:
 This one time, at band camp, Richard Lynch [EMAIL PROTECTED] wrote:

 If you've benchmarked on YOUR hardware and have a proven savings,
 fine, post your tests and output.

 Already done in previous threads.

Actually, to be pedantic, you've provided a reference to a dead tree
magazine, which I don't happen to have...

 nowhere do I say the db is faster than file system. Just that various
 methods of db access are
 faster than others. I fail to see you point here? Do you have one?

Yes.

If your primary consideration is performance, then you need to test on
YOUR hardware with YOUR setup.

 I have simply asked a question of those debunking the idea of binary
 storage how much
 of a performance hit do they think it takes, I have done _my_
 homework, I wonder if
 others have?
 You are quick to ask for benchmarks. Where are yours?

My primary consideration has never been performance.

I'm more concerned about the disaster recovery of a DB from a crashed
hard drive, which has been cluttered up with binary data, making data
recovery.

Other considerations are that your DB client/server buffer size has to
be large enough to handle the images.

Then your field storage size has to be large enough.

Given the number of posts here in PHP-General alone, of people getting
tripped up by these things, I have concluded that cramming images into
the DB is far more trouble than it is worth.

It *seems* like a Good Idea until you actually do it for awhile, and
then run into all these snags.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD to database directly

2006-07-14 Thread Kevin Waterson
This one time, at band camp, Richard Lynch [EMAIL PROTECTED] wrote:


 I'm more concerned about the disaster recovery of a DB from a crashed
 hard drive, which has been cluttered up with binary data, making data
 recovery.

One of the greatest benifits of binary DB storage is a single point
of back up
mysqldump db_name  backup.sql -u username -p
It really is as simple as that and no need to bother about referential
integrity when rebuilding, simple
mysql db_name  back.sql -u username -p

How much easier does it get?
 
 Then your field storage size has to be large enough.

LONGBLOB

 Given the number of posts here in PHP-General alone, of people getting
 tripped up by these things, I have concluded that cramming images into
 the DB is far more trouble than it is worth.
 
 It *seems* like a Good Idea until you actually do it for awhile, and
 then run into all these snags.

Oddly enough, I have never run into them. Nor has terraserver which stores
hundreds of thousands of images in its db, although not mysql.

Kevin

-- 
Democracy is two wolves and a lamb voting on what to have for lunch. 
Liberty is a well-armed lamb contesting the vote.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD to database directly

2006-07-13 Thread Kevin Waterson
This one time, at band camp, Richard Lynch [EMAIL PROTECTED] wrote:


 It's coming FROM THE FILE SYSTEM.

databases can be stored on RAW partitions, thus eliminating FILE SYSTEM
overhead

Kevin

-- 
Democracy is two wolves and a lamb voting on what to have for lunch. 
Liberty is a well-armed lamb contesting the vote.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD to database directly

2006-07-13 Thread Kevin Waterson
This one time, at band camp, Richard Lynch [EMAIL PROTECTED] wrote:


 You really need to TEST your assumption about the DB being faster.

Do you _really_ think I am speaking without testing any of this??
I once wrote an article on this very topic in PHP mag and published the 
benchmarks.

Kevin

-- 
Democracy is two wolves and a lamb voting on what to have for lunch. 
Liberty is a well-armed lamb contesting the vote.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD to database directly

2006-07-13 Thread Richard Lynch
On Tue, July 11, 2006 11:38 am, Eric Butera wrote:
 I don't see a problem with storing images in the DB IF they aren't
 going to be continually accessed that way.  For example say you have a
 script that lets a user upload an image and creates a small, medium,
 and large view out of it.  Stick the original in the Db and then make
 your 3 sizes on the fly and cache the output so they are not
 continually created.  This way you could down the road re-do all the
 sizes if you go through a site redesign or the client chooses they
 want them 450 instead of 400. =)

And this would be better than just throwing the original in the file
system in what way?...

I'm sure not seeing a plus to having the original images in the DB
instead of the file system here.

I *just* do not understand why you'd want to cram this ginormous chunk
of binary data into the DB.

You're NOT going to sort on it.

You're NOT going to filter it based on what's in the binary data.

There are ZERO functions internal to SQL that can do anything at all
useful with the data.  Maybe if MySQL had GD integrated, and you could
do:
SELECT imagescaled(image, 400, 300) FROM images

But it doesn't.  And you're not the CIA using AI feature recognition
to compare the photos in your DB with an SQL function.

You're just shuffling data through layer after layer after layer of DB
calls so it can sit on the same damned hard drive, clogging up the DB
space, and making HD disaster recovery of the data in the DB far far
far more difficult.

And for what?

To avoid a few lines of code in your web application to keep the db
and file-system in sync?

Puhlease.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD to database directly

2006-07-13 Thread Richard Lynch
On Thu, July 13, 2006 1:25 pm, Kevin Waterson wrote:
 This one time, at band camp, Richard Lynch [EMAIL PROTECTED] wrote:


 It's coming FROM THE FILE SYSTEM.

 databases can be stored on RAW partitions, thus eliminating FILE
 SYSTEM
 overhead

And are you actually doing this, or merely introducing a non-existent
scenario?

Even on a raw partition, the database still has to do *something* to
move the drive heads and read the data.

Provide a benchmark with the raw partition, images in DB, compared on
equivalent hardware with a static file system approach, by all means.

I'm sure you'll prove it provides some performance gain.

And it probably has almost nothing to do with any list reader's
real-world scenario.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD to database directly

2006-07-13 Thread Kevin Waterson
This one time, at band camp, Richard Lynch [EMAIL PROTECTED] wrote:



 If you've benchmarked on YOUR hardware and have a proven savings,
 fine, post your tests and output.

Already done in previous threads.
nowhere do I say the db is faster than file system. Just that various methods 
of db access are
faster than others. I fail to see you point here? Do you have one?
I have simply asked a question of those debunking the idea of binary storage 
how much
of a performance hit do they think it takes, I have done _my_ homework, I 
wonder if
others have?
You are quick to ask for benchmarks. Where are yours?

Kevin

-- 
Democracy is two wolves and a lamb voting on what to have for lunch. 
Liberty is a well-armed lamb contesting the vote.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] GD to database directly

2006-07-12 Thread Jay Blanchard
[snip]
How much of a performance hit?
[/snip]

Here is an interesting read;

http://mysqldump.azundris.com/archives/36-Serving-Images-From-A-Database
.html

Your system receives a number of file read requests, requesting it to
load a number of blocks from the disk into the mysqld process.
Eventually, the blocks show up in the buffer cache, and mysqld is woken
up, receiving file data for the read requests.

But I will say this, in this day and age there may not be the
performance hit that we had in days gone by due to improvements in
software and hardware, so I may have misspoken. I do believe in a one
for one comparison where we use PHP and the file system or PHP and MySQL
on the same box that, however minimal, there will be a difference
favoring the file system using the same images. 

I also believe that these methods should be compared to using MySQL to
hold data about the image so that the benchmarks could be run like this;

PHP + File System
PHP + MySQL (where MySQL stores a BLOB)
PHP + MySQL (data only) + File System

The reason for the last one is that is the likely way these technologies
would be used together.

I spend a lot of time utilizing the MySQL command line and other similar
query analysis tools for MS-SQL and Oracle. Image BLOBs become more of a
hindrance than a help at this level because these tools are not designed
to properly parse and display the files. This is important because it
adds to my bias against storing images in a database.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD to database directly

2006-07-12 Thread Eric Butera

On 7/11/06, Adam Zey [EMAIL PROTECTED] wrote:


The time taken per request, though (and that's about all we can get with
a concurrency as low as 5) doesn't tell us much. We also don't know
exactly what the PHP code is doing, how it does it, how your database is
organized/indexed/accessed, if you have any PHP accelerators installed
(Normally the PHP script would be reconverted to bytecode every
execution), etc.

Additionally, your test isn't really MySQL versus filesystem, it's
PHP+MySQL versus filesystem. Perhaps a more useful comparison would be
PHP+Filesystem versus PHP+MySQL. As in, the same PHP script for both
benchmarks, except one copy uses file_get_contents and echo (Closer
match than readfile, since MySQL would require loading the file into
memory) and the other uses MySQL. This would be a closer match that
would tell us how much latency is induced by the actual database itself
rather than PHP and loading stuff into memory.

Regards, Adam.



I was just running a simple test based on how I work with images.  I
usually upload one, resize it on the fly, and save a new image which I
directly link to.  Therefore I don't need anything to read and send a
raw image through PHP.  If you think that is a valid test, then
perhaps you should use your own time to achive your adequate
benchmark.

As for my script:
?php
$link = mysql_connect('localhost', 'test', 'test') or die('unable to connect');
mysql_select_db('test') or die('unable to select');

$sql = SELECT imagedata FROM images WHERE id = 1;

$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);

header('Content-Type: image/jpeg');
echo $row['imagedata'];


There is an auto inc primary on the id column.

I have APC disabled during this test so that isn't a problem.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD to database directly

2006-07-12 Thread Richard Lynch
On Tue, July 11, 2006 1:48 am, Kevin Waterson wrote:
 This one time, at band camp, Austin Denyer [EMAIL PROTECTED] wrote:

 It is generally accepted that storing things like that in a database
 is
 a Bad Thing.  Much better to store the images as files and store the
 path in the database.

 Storing paths and databases in slower than just storing images in the
 db
 or simnply storing them on the server. You are making a db request and
 a
 file system request. Rather than a single request to the db.
 What is a file system if not a database?

Operating System File System:
A highly-optimized well-tested database for large-sized binary data.

Or...

What is a database if not a file system? :-)


You really need to TEST your assumption about the DB being faster.

Where do you think the DB gets the humongous chunk of binary data?

You think it's magic?

No.

It's coming FROM THE FILE SYSTEM.

Ultimately, the hard drive is still getting pounded just as hard, by
most DBs for most images, if you cram the image into the DB, because
the chunk of data is:
A) too large to be in RAM, and
B) stored as a 'BLOB', which in most DBs, means it's stuck into a
separate file, or at least into a separate offset within a monster
file, which means the hard drive still has to do a seek to get to it.

So, really, you're not saving anything, on MOST hardware setups,
*unless* the images are all very very very tiny.

If you've benchmarked on YOUR hardware and have a proven savings,
fine, post your tests and output.

If you have no benchmarks, I suggest you do that before you claim it's
faster

:-)

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD to database directly

2006-07-11 Thread Kevin Waterson
This one time, at band camp, Jay Blanchard [EMAIL PROTECTED] wrote:


 1. Do not store images in a database, it is just a bad idea from a
 performance perspective (as has been covered many times heretofore). 

rubbish, has been proven other wise, you are quoting old wives tales
Please provide benchmarks to back this.

Kevin


-- 
Democracy is two wolves and a lamb voting on what to have for lunch. 
Liberty is a well-armed lamb contesting the vote.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD to database directly

2006-07-11 Thread Kevin Waterson
This one time, at band camp, Austin Denyer [EMAIL PROTECTED] wrote:


 It is generally accepted that storing things like that in a database is
 a Bad Thing.  Much better to store the images as files and store the
 path in the database.

Storing paths and databases in slower than just storing images in the db
or simnply storing them on the server. You are making a db request and a
file system request. Rather than a single request to the db.
What is a file system if not a database?

Kevin


-- 
Democracy is two wolves and a lamb voting on what to have for lunch. 
Liberty is a well-armed lamb contesting the vote.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD to database directly

2006-07-11 Thread Kevin Waterson
This one time, at band camp, Larry Garfield [EMAIL PROTECTED] wrote:


 There may be other reasons you'd want to store binary data in an SQL 
 database, 
 but it will always be a performance hit over just passing a normal file that 
 can be streamed right off the disk to the server's NIC.

How much of  a performance hit?

Kevin

-- 
Democracy is two wolves and a lamb voting on what to have for lunch. 
Liberty is a well-armed lamb contesting the vote.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD to database directly

2006-07-11 Thread Eric Butera

On 7/11/06, Kevin Waterson [EMAIL PROTECTED] wrote:


How much of  a performance hit?

Kevin

--
Democracy is two wolves and a lamb voting on what to have for lunch.
Liberty is a well-armed lamb contesting the vote.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Here's to being bored on lunch. :)


Now to add my two cents to the convo:
I don't see a problem with storing images in the DB IF they aren't
going to be continually accessed that way.  For example say you have a
script that lets a user upload an image and creates a small, medium,
and large view out of it.  Stick the original in the Db and then make
your 3 sizes on the fly and cache the output so they are not
continually created.  This way you could down the road re-do all the
sizes if you go through a site redesign or the client chooses they
want them 450 instead of 400. =)


Via MySQL 4.1  PHP 5.1.4:
erics:~ eric$ ab -n500 -c5 http://localhost/fs_vs_db/viewimage_db.php
This is ApacheBench, Version 1.3d $Revision: 1.73 $ apache-1.3
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Finished 500 requests
Server Software:Apache/1.3.33
Server Hostname:localhost
Server Port:80

Document Path:  /fs_vs_db/viewimage_db.php
Document Length:25256 bytes

Concurrency Level:  5
Time taken for tests:   4.323 seconds
Complete requests:  500
Failed requests:0
Broken pipe errors: 0
Total transferred:  12727000 bytes
HTML transferred:   12628000 bytes
Requests per second:115.66 [#/sec] (mean)
Time per request:   43.23 [ms] (mean)
Time per request:   8.65 [ms] (mean, across all concurrent requests)
Transfer rate:  2944.02 [Kbytes/sec] received

Connnection Times (ms)
 min  mean[+/-sd] median   max
Connect:0 00.4  010
Processing:1442   12.6 38   147
Waiting:   1442   12.6 38   147
Total: 1442   12.6 38   147

Percentage of the requests served within a certain time (ms)
 50% 38
 66% 40
 75% 44
 80% 46
 90% 56
 95% 67
 98% 78
 99% 97
100%147 (last request)





Raw Image:
erics:~ eric$ ab -n500 -c5 http://localhost/fs_vs_db/cloud.jpg
This is ApacheBench, Version 1.3d $Revision: 1.73 $ apache-1.3
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Finished 500 requests
Server Software:Apache/1.3.33
Server Hostname:localhost
Server Port:80

Document Path:  /fs_vs_db/cloud.jpg
Document Length:25256 bytes

Concurrency Level:  5
Time taken for tests:   0.624 seconds
Complete requests:  500
Failed requests:0
Broken pipe errors: 0
Total transferred:  12775000 bytes
HTML transferred:   12628000 bytes
Requests per second:801.28 [#/sec] (mean)
Time per request:   6.24 [ms] (mean)
Time per request:   1.25 [ms] (mean, across all concurrent requests)
Transfer rate:  20472.76 [Kbytes/sec] received

Connnection Times (ms)
 min  mean[+/-sd] median   max
Connect:0 10.7  1 5
Processing: 3 56.6  4   131
Waiting:1 46.7  3   130
Total:  3 66.5  5   131

Percentage of the requests served within a certain time (ms)
 50%  5
 66%  5
 75%  5
 80%  6
 90%  7
 95% 10
 98% 11
 99% 19
100%131 (last request)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD to database directly

2006-07-11 Thread Adam Zey

Eric Butera wrote:

On 7/11/06, Kevin Waterson [EMAIL PROTECTED] wrote:


How much of  a performance hit?

Kevin

--
Democracy is two wolves and a lamb voting on what to have for lunch.
Liberty is a well-armed lamb contesting the vote.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Here's to being bored on lunch. :)


Now to add my two cents to the convo:
I don't see a problem with storing images in the DB IF they aren't
going to be continually accessed that way.  For example say you have a
script that lets a user upload an image and creates a small, medium,
and large view out of it.  Stick the original in the Db and then make
your 3 sizes on the fly and cache the output so they are not
continually created.  This way you could down the road re-do all the
sizes if you go through a site redesign or the client chooses they
want them 450 instead of 400. =)


Via MySQL 4.1  PHP 5.1.4:
erics:~ eric$ ab -n500 -c5 http://localhost/fs_vs_db/viewimage_db.php
This is ApacheBench, Version 1.3d $Revision: 1.73 $ apache-1.3
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, 
http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, 
http://www.apache.org/


Benchmarking localhost (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Finished 500 requests
Server Software:Apache/1.3.33
Server Hostname:localhost
Server Port:80

Document Path:  /fs_vs_db/viewimage_db.php
Document Length:25256 bytes

Concurrency Level:  5
Time taken for tests:   4.323 seconds
Complete requests:  500
Failed requests:0
Broken pipe errors: 0
Total transferred:  12727000 bytes
HTML transferred:   12628000 bytes
Requests per second:115.66 [#/sec] (mean)
Time per request:   43.23 [ms] (mean)
Time per request:   8.65 [ms] (mean, across all concurrent requests)
Transfer rate:  2944.02 [Kbytes/sec] received

Connnection Times (ms)
 min  mean[+/-sd] median   max
Connect:0 00.4  010
Processing:1442   12.6 38   147
Waiting:   1442   12.6 38   147
Total: 1442   12.6 38   147

Percentage of the requests served within a certain time (ms)
 50% 38
 66% 40
 75% 44
 80% 46
 90% 56
 95% 67
 98% 78
 99% 97
100%147 (last request)





Raw Image:
erics:~ eric$ ab -n500 -c5 http://localhost/fs_vs_db/cloud.jpg
This is ApacheBench, Version 1.3d $Revision: 1.73 $ apache-1.3
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, 
http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, 
http://www.apache.org/


Benchmarking localhost (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Finished 500 requests
Server Software:Apache/1.3.33
Server Hostname:localhost
Server Port:80

Document Path:  /fs_vs_db/cloud.jpg
Document Length:25256 bytes

Concurrency Level:  5
Time taken for tests:   0.624 seconds
Complete requests:  500
Failed requests:0
Broken pipe errors: 0
Total transferred:  12775000 bytes
HTML transferred:   12628000 bytes
Requests per second:801.28 [#/sec] (mean)
Time per request:   6.24 [ms] (mean)
Time per request:   1.25 [ms] (mean, across all concurrent requests)
Transfer rate:  20472.76 [Kbytes/sec] received

Connnection Times (ms)
 min  mean[+/-sd] median   max
Connect:0 10.7  1 5
Processing: 3 56.6  4   131
Waiting:1 46.7  3   130
Total:  3 66.5  5   131

Percentage of the requests served within a certain time (ms)
 50%  5
 66%  5
 75%  5
 80%  6
 90%  7
 95% 10
 98% 11
 99% 19
100%131 (last request)


The time taken per request, though (and that's about all we can get with 
a concurrency as low as 5) doesn't tell us much. We also don't know 
exactly what the PHP code is doing, how it does it, how your database is 
organized/indexed/accessed, if you have any PHP accelerators installed 
(Normally the PHP script would be reconverted to bytecode every 
execution), etc.


Additionally, your test isn't really MySQL versus filesystem, it's 
PHP+MySQL versus filesystem. Perhaps a more useful comparison would be 
PHP+Filesystem versus PHP+MySQL. As in, the same PHP script for both 
benchmarks, except one copy uses file_get_contents and echo (Closer 
match than readfile, since MySQL would require loading the file into 
memory) and the other uses MySQL. This would be a closer match that 
would tell us how much latency is induced by the actual database itself 
rather than PHP and loading stuff into memory.


Regards, Adam.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD to database directly

2006-07-10 Thread Larry Garfield
On Monday 10 July 2006 09:31, Peter Lauri wrote:
 [snip]
 1. Do not store images in a database, it is just a bad idea from a
 performance perspective (as has been covered many times heretofore).
 [/snip]

 Is that really the case? Is this not depending on the application? :) My
 application will never grow, and I can easily just change the file storage
 procedure by changing in my file storage class if a change will be
 necessary.

 /Peter

The process of loading a script that then loads a database driver and makes an 
SQL call to retrieve a bitstream and set the correct header and then print 
the bitstream is slower than the process of sending a URL to the browser 
which can then make a simple HTTP request against a static file.  Always.

There may be other reasons you'd want to store binary data in an SQL database, 
but it will always be a performance hit over just passing a normal file that 
can be streamed right off the disk to the server's NIC.

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it.  -- Thomas 
Jefferson

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] GD to database directly

2006-07-10 Thread Jay Blanchard
[snip]
I am creating images via GD and want to save them to the database. Right
now
I save them to the disk and then save them to the database. Is it
possible
to write them directly to the database and skip the middle step where I
temporary write it to the hard disk?
[/snip]

1. Do not store images in a database, it is just a bad idea from a
performance perspective (as has been covered many times heretofore). 
2. If you insist on storing the image in a database you can use any of
the image output functions, for instance;

INSERT INTO `table` (`picture`)
VALUE ('.imagegd($resource, 'imagename').')

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] GD to database directly

2006-07-10 Thread Peter Lauri
[snip]
1. Do not store images in a database, it is just a bad idea from a
performance perspective (as has been covered many times heretofore). 
[/snip]

Is that really the case? Is this not depending on the application? :) My
application will never grow, and I can easily just change the file storage
procedure by changing in my file storage class if a change will be
necessary.

/Peter

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD to database directly

2006-07-10 Thread Austin Denyer
Peter Lauri wrote:

 [snip]
 1. Do not store images in a database, it is just a bad idea from a
 performance perspective (as has been covered many times heretofore). 
 [/snip]
 
 Is that really the case? Is this not depending on the application? :) My
 application will never grow, and I can easily just change the file storage
 procedure by changing in my file storage class if a change will be
 necessary.

It is generally accepted that storing things like that in a database is
a Bad Thing.  Much better to store the images as files and store the
path in the database.

Regards,
Austin.


signature.asc
Description: OpenPGP digital signature


RE: [PHP] GD problems

2006-06-23 Thread Beauford
Since I know nothing of how this works, does this actually create a physical
image, and if it does I'm assuming it would be in the originating directory
from where the script was run  - if this is the case, I got nothing.

This is a moot point now as I have done what I need without using gd, but it
would be nice to find out what the problem is.

Thanks.

 Anyone know of a way I can test this further. A small script perhaps.

?php
  $image = imagecreatetruecolor(50, 50);
  imagefilledrectangle($image, 0, 0, 50, 50, 0xff);
  imagejpeg($image);
?

--
Like Music?
http://l-i-e.com/artists.htm

--
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] GD problems

2006-06-23 Thread Chris

Beauford wrote:

Since I know nothing of how this works, does this actually create a physical
image, and if it does I'm assuming it would be in the originating directory
from where the script was run  - if this is the case, I got nothing.

This is a moot point now as I have done what I need without using gd, but it
would be nice to find out what the problem is.

Thanks.


Anyone know of a way I can test this further. A small script perhaps.


?php
  $image = imagecreatetruecolor(50, 50);
  imagefilledrectangle($image, 0, 0, 50, 50, 0xff);
  imagejpeg($image);
?


It creates it in memory and it's a 50 x 50 white square.

Change the 0xff to 0xFF6600 and it should be a red square.

--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] GD problems

2006-06-23 Thread Beauford
 
Here's something else I just noticed. When I run the script below in Windows
it works fine, in Linux I get this error:

Fatal error: Call to undefined function bcmod() in
/usr/local/apache/htdocs/home/cap.php on line 62

This is line 62: $pos_x = bcmod($code,$size_x-60) +3;

Linux is running PHP 5.0, Windows 4.4.

Thanks

---

?

//Select size of image
$size_x = 75;
$size_y = 25;

//generate random string
$code = mt_rand(10,99);

//store captcha code in session vars
session_start(  );
$_SESSION['captcha_code'] = $code;

//create image to play with
$image = imageCreate($size_x,$size_y);


//add content to image
//--


//make background white - first colour allocated is background
$background = imageColorAllocate($image,255,255,255);



//select grey content number
$text_number1 = mt_rand(0,150);
$text_number2 = mt_rand(0,150);
$text_number3 = mt_rand(0,150);

//allocate colours
$white = imageColorAllocate($image,255,255,255);
$black = imageColorAllocate($image,0,0,0);
$text  =
imageColorAllocate($image,$text_number1,$text_number2,$text_number3);



//get number of dots to draw
$total_dots = ($size_x * $size_y)/15;

//draw many many dots that are the same colour as the text
for($counter = 0; $counter  $total_dots; $counter++) {
  //get positions for dot
  $pos_x = mt_rand(0,$size_x);
  $pos_y = mt_rand(0,$size_y);

  //draw dot
  imageSetPixel($image,$pos_x,$pos_y,$text);
};



//draw border
imageRectangle($image,0,0,$size_x-1,$size_y-1,$black);



//get coordinates of position for string
//on the font 5 size, each char is 15 pixels high by 9 pixels wide
//with 6 digits at a width of 9, the code is 54 pixels wide
$pos_x = bcmod($code,$size_x-60) +3;
$pos_y = bcmod($code,$size_y-15);

//draw random number
imageString($image,  5,  $pos_x,  $pos_y,  $code,  $text);


//--
//end add content to image


//send browser headers
header(Content-Type: image/png);


//send image to browser
echo imagePNG($image);


//destroy image
imageDestroy($image);



?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] GD problems

2006-06-23 Thread Beauford
OK, so that works. So is gd (or one of the required programs) wonky then - I
mean 4 out of 5 scripts I downloaded didn't work. I can't see all of these
people being bad programmers.., but the funny thing is they all work on
Windows. So that can't be it - is there still something I'm missing in Linux
that is required by these scripts? This is what I've been fighting with the
last two weeks.

Thanks for all the help.

-Original Message-
From: Chris [mailto:[EMAIL PROTECTED] 
Sent: June 23, 2006 2:20 AM
To: Beauford
Cc: php-general@lists.php.net
Subject: Re: [PHP] GD problems

Beauford wrote:
 Since I know nothing of how this works, does this actually create a 
 physical image, and if it does I'm assuming it would be in the 
 originating directory from where the script was run  - if this is the
case, I got nothing.
 
 This is a moot point now as I have done what I need without using gd, 
 but it would be nice to find out what the problem is.
 
 Thanks.
 
 Anyone know of a way I can test this further. A small script perhaps.
 
 ?php
   $image = imagecreatetruecolor(50, 50);
   imagefilledrectangle($image, 0, 0, 50, 50, 0xff);
   imagejpeg($image);
 ?

It creates it in memory and it's a 50 x 50 white square.

Change the 0xff to 0xFF6600 and it should be a red square.

--
Postgresql  php tutorials
http://www.designmagick.com/

--
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] GD problems

2006-06-23 Thread chris smith

On 6/24/06, Beauford [EMAIL PROTECTED] wrote:


Here's something else I just noticed. When I run the script below in Windows
it works fine, in Linux I get this error:

Fatal error: Call to undefined function bcmod() in
/usr/local/apache/htdocs/home/cap.php on line 62


David told you about this 3-4 replies ago.

http://marc.theaimsgroup.com/?l=php-generalm=115095875203362w=2

bcmod is a bcmath function, if you don't have bcmath installed you
can't use that function.

http://www.php.net/manual/en/ref.bc.php

--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] GD problems

2006-06-23 Thread Beauford
Honestly, I've never seen anything so ridiculous. How is one to know that in
order to get one program to work you have to install 28 others. I'm not
trying to be a smart ass here, but seriously - No where in any documentation
I've read does it say I need to install all these other packages. Would it
just not be simpler to add them to the original package, and then check
whether or not it's installed - if not, install it. Or at the very least
include all the packages needed and the user can install them if need be. By
the way, I never saw Marks post - it might have saved me some time if I had
though.

Thanks to everyone.

B

-Original Message-
From: chris smith [mailto:[EMAIL PROTECTED]
Sent: June 23, 2006 6:11 PM
To: Beauford
Cc: php-general@lists.php.net
Subject: Re: [PHP] GD problems

On 6/24/06, Beauford [EMAIL PROTECTED] wrote:

 Here's something else I just noticed. When I run the script below in 
 Windows it works fine, in Linux I get this error:

 Fatal error: Call to undefined function bcmod() in 
 /usr/local/apache/htdocs/home/cap.php on line 62

David told you about this 3-4 replies ago.

http://marc.theaimsgroup.com/?l=php-generalm=115095875203362w=2

bcmod is a bcmath function, if you don't have bcmath installed you can't use
that function.

http://www.php.net/manual/en/ref.bc.php

--
Postgresql  php tutorials
http://www.designmagick.com/

--
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] GD problems

2006-06-23 Thread chris smith

On 6/24/06, Beauford [EMAIL PROTECTED] wrote:

Honestly, I've never seen anything so ridiculous. How is one to know that in
order to get one program to work you have to install 28 others. I'm not
trying to be a smart ass here, but seriously - No where in any documentation
I've read does it say I need to install all these other packages. Would it
just not be simpler to add them to the original package, and then check
whether or not it's installed - if not, install it. Or at the very least
include all the packages needed and the user can install them if need be. By
the way, I never saw Marks post - it might have saved me some time if I had
though.


Complain to the author(s) of the scripts. GD doesn't need bcmath, that
script does.
--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] GD problems

2006-06-22 Thread David Robley
Beauford wrote:

  
 There is something wonky with gd. I completely reinstalled Slackware
 today, including PHP, gd, and all the other stuff - and still nothing.
 
 I downloaded 5 separate captcha scripts and only got one to work. The code
 in all of them is very similar in that it creates a graphic with random
 letters and numbers.
 
 Here is the entire code from one that doesn't work.
 
 ?
 
 //---
 //This program is free software; you can redistribute it and/or
 //modify it under the terms of the GNU General Public License
 //as published by the Free Software Foundation; either version 2
 //of the License, or (at your option) any later version.
 //
 //This program is distributed in the hope that it will be useful,
 //but WITHOUT ANY WARRANTY; without even the implied warranty of
 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 //GNU General Public License for more details.
 //
 //Meezerk's CAPTCHA - A Computer Assisted Program for Telling
 //Computers and Humans Apart
 //Copyright (C) 2004  Daniel Foster  [EMAIL PROTECTED]
 //---
 
 //Select size of image
 $size_x = 75;
 $size_y = 25;
 
 //generate random string
 $code = mt_rand(10,99);
 
 //store captcha code in session vars
 session_start(  );
 $_SESSION['captcha_code'] = $code;
 
 //create image to play with
 $image = imageCreate($size_x,$size_y);
 
 
 //add content to image
 //--
 
 
 //make background white - first colour allocated is background
 $background = imageColorAllocate($image,255,255,255);
 
 
 
 //select grey content number
 $text_number1 = mt_rand(0,150);
 $text_number2 = mt_rand(0,150);
 $text_number3 = mt_rand(0,150);
 
 //allocate colours
 $white = imageColorAllocate($image,255,255,255);
 $black = imageColorAllocate($image,0,0,0);
 $text  =
 imageColorAllocate($image,$text_number1,$text_number2,$text_number3);
 
 
 
 //get number of dots to draw
 $total_dots = ($size_x * $size_y)/15;
 
 //draw many many dots that are the same colour as the text
 for($counter = 0; $counter  $total_dots; $counter++) {
   //get positions for dot
   $pos_x = mt_rand(0,$size_x);
   $pos_y = mt_rand(0,$size_y);
 
   //draw dot
   imageSetPixel($image,$pos_x,$pos_y,$text);
 };
 
 
 
 //draw border
 imageRectangle($image,0,0,$size_x-1,$size_y-1,$black);
 
 
 
 //get coordinates of position for string
 //on the font 5 size, each char is 15 pixels high by 9 pixels wide
 //with 6 digits at a width of 9, the code is 54 pixels wide
 $pos_x = bcmod($code,$size_x-60) +3;
 $pos_y = bcmod($code,$size_y-15);
 
 //draw random number
 imageString($image,  5,  $pos_x,  $pos_y,  $code,  $text);
 
 
 //--
 //end add content to image
 
 
 //send browser headers
 header(Content-Type: image/jpeg);
 
 
 //send image to browser
 echo imagejpeg($image);
 
 
 //destroy image
 imageDestroy($image);
 
 
 ?

Well, you may not have the BCmath enabled, and this script will break if
bcmod isn't there, probably without you seeing an error message.

A tip for debugging image scripts - comment out the line like 

header(Content-Type: image/jpeg);

and run the script again; if there is an error it will be displayed (error
settings permitting) whereas with the header in place, all you will get is
the broken image icon, most likely.

Cheers
-- 
David Robley

A life lived in fear is half a life lived.
Today is Pungenday, the 27th day of Confusion in the YOLD 3172. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] GD problems

2006-06-22 Thread Richard Lynch
On Wed, June 21, 2006 1:06 pm, Beauford wrote:
 This is the output from ?php var_dump(gd_info()); ?. As far as I can
 tell,
 jpeg support is enabled. It also says it is if I run phpinfo(). Yet is
 still
 doesn't work.

 Anyone know of a way I can test this further. A small script perhaps.

?php
  $image = imagecreatetruecolor(50, 50);
  imagefilledrectangle($image, 0, 0, 50, 50, 0xff);
  imagejpeg($image);
?

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] GD problems

2006-06-21 Thread Beauford
This is the output from ?php var_dump(gd_info()); ?. As far as I can tell,
jpeg support is enabled. It also says it is if I run phpinfo(). Yet is still
doesn't work. 

Anyone know of a way I can test this further. A small script perhaps.

Thanks

array(11) { [GD Version]= string(27) bundled (2.0.23 compatible)
[FreeType Support]= bool(false) [T1Lib Support]= bool(false) [GIF
Read Support]= bool(true) [GIF Create Support]= bool(false) [JPG
Support]= bool(true) [PNG Support]= bool(true) [WBMP Support]=
bool(true) [XPM Support]= bool(false) [XBM Support]= bool(true)
[JIS-mapped Japanese Font Support]= bool(false) }  

-Original Message-
From: Chris [mailto:[EMAIL PROTECTED] 
Sent: June 20, 2006 8:51 PM
To: Beauford
Cc: php-general@lists.php.net
Subject: Re: [PHP] GD problems

Beauford wrote:
 After my last email I searched around some more and found the following.
 
 /Q: gd keeps saying it can't find png or jpeg support. I did install 
 libpng and libjpeg. What am I missing?/
 /A: Be sure to do make install-headers for libpng and make 
 install-lib for libjpeg, in addition to make install./
 
 This is basically what you were saying, but as I said these header 
 files do not exist on their own (for Slackware anyways) and just by 
 chance I came across the above, but in any event it still doesn't 
 work.  It might be nice though if somewhere in the instructions it 
 says, hey, you might need to do this.
 
 Then I found this when searching on the jpeg errors I keep getting.
 
 /This error occures becuase the linker (ld) cannot find the jpeg 
 library./ /You can fix this problem by editing the config.nice file 
 inside the php4/ /directory and adding / /LDFLAGS='-L/path/to/lib' \ / 
 /above the ./configure \ /
 
 /For example is your libjpeg.so resides inside /usr/local/lib, you'd 
 add/ /-L/usr/local./
 
 /Once you've edited the file, remove config.cache and run 
 ./config.nice,/ /after that make; make install; should work./
 
 Since my/// libjpeg.so / is in /usr/lib I put/// LDFLAGS='-L/user' \/ 
 - I still get the same error. If I compile without the jpeg it works 
 like a charm - so I recompiled libjpeg thinking it may have gotten 
 screwed up, but same errors.
 
 So the question is, why can't it find these files?
 
 Any ideas on what else I can do. I'm assuming that other people have 
 this working on Slackware, if so, how did they do it? I posted to that 
 forum as well and didn't get one answer.

Please always CC the list - you'll get more (and faster) help.

As David suggested, try adding this:

--with-jpeg-dir=/usr --with-png-dir=/usr

to the php configure command.

If that doesn't work, where is the jpeglib.h file?

Mine is in the /usr/include folder, so I use /usr for the --with-jpeg-dir
parameter.

If that file doesn't exist anywhere on your system, you haven't got the
headers installed for libjpeg.

--
Postgresql  php tutorials
http://www.designmagick.com/

--
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] GD problems

2006-06-21 Thread Chris

Beauford wrote:

This is the output from ?php var_dump(gd_info()); ?. As far as I can tell,
jpeg support is enabled. It also says it is if I run phpinfo(). Yet is still
doesn't work. 


Show us some code that doesn't work and you'll probably get some 
suggestions.


--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] GD problems

2006-06-21 Thread Beauford
 
There is something wonky with gd. I completely reinstalled Slackware today,
including PHP, gd, and all the other stuff - and still nothing.

I downloaded 5 separate captcha scripts and only got one to work. The code
in all of them is very similar in that it creates a graphic with random
letters and numbers.

Here is the entire code from one that doesn't work.

?

//---
//This program is free software; you can redistribute it and/or
//modify it under the terms of the GNU General Public License
//as published by the Free Software Foundation; either version 2
//of the License, or (at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.
//
//Meezerk's CAPTCHA - A Computer Assisted Program for Telling 
//Computers and Humans Apart
//Copyright (C) 2004  Daniel Foster  [EMAIL PROTECTED]
//---

//Select size of image
$size_x = 75;
$size_y = 25;

//generate random string
$code = mt_rand(10,99);

//store captcha code in session vars
session_start(  );
$_SESSION['captcha_code'] = $code;

//create image to play with
$image = imageCreate($size_x,$size_y);


//add content to image
//--


//make background white - first colour allocated is background
$background = imageColorAllocate($image,255,255,255);



//select grey content number
$text_number1 = mt_rand(0,150);
$text_number2 = mt_rand(0,150);
$text_number3 = mt_rand(0,150);

//allocate colours
$white = imageColorAllocate($image,255,255,255);
$black = imageColorAllocate($image,0,0,0);
$text  =
imageColorAllocate($image,$text_number1,$text_number2,$text_number3);



//get number of dots to draw
$total_dots = ($size_x * $size_y)/15;

//draw many many dots that are the same colour as the text
for($counter = 0; $counter  $total_dots; $counter++) {
  //get positions for dot
  $pos_x = mt_rand(0,$size_x);
  $pos_y = mt_rand(0,$size_y);

  //draw dot
  imageSetPixel($image,$pos_x,$pos_y,$text);
};



//draw border
imageRectangle($image,0,0,$size_x-1,$size_y-1,$black);



//get coordinates of position for string
//on the font 5 size, each char is 15 pixels high by 9 pixels wide
//with 6 digits at a width of 9, the code is 54 pixels wide
$pos_x = bcmod($code,$size_x-60) +3;
$pos_y = bcmod($code,$size_y-15);

//draw random number
imageString($image,  5,  $pos_x,  $pos_y,  $code,  $text);


//--
//end add content to image


//send browser headers
header(Content-Type: image/jpeg);


//send image to browser
echo imagejpeg($image);


//destroy image
imageDestroy($image);


?

-Original Message-
From: Chris [mailto:[EMAIL PROTECTED] 
Sent: June 21, 2006 8:41 PM
To: Beauford
Cc: php-general@lists.php.net
Subject: Re: [PHP] GD problems

Beauford wrote:
 This is the output from ?php var_dump(gd_info()); ?. As far as I can 
 tell, jpeg support is enabled. It also says it is if I run phpinfo(). 
 Yet is still doesn't work.

Show us some code that doesn't work and you'll probably get some
suggestions.

--
Postgresql  php tutorials
http://www.designmagick.com/

--
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] GD problems

2006-06-20 Thread Chris

Beauford wrote:

After my last email I searched around some more and found the following.

/Q: gd keeps saying it can't find png or jpeg support. I did install 
libpng and libjpeg. What am I missing?/
/A: Be sure to do make install-headers for libpng and make 
install-lib for libjpeg, in addition to make install./


This is basically what you were saying, but as I said these header files 
do not exist on their own (for Slackware anyways) and just by chance I 
came across the above, but in any event it still doesn't work.  It might 
be nice though if somewhere in the instructions it says, hey, you might 
need to do this.


Then I found this when searching on the jpeg errors I keep getting.

/This error occures becuase the linker (ld) cannot find the jpeg library./
/You can fix this problem by editing the config.nice file inside the php4/
/directory and adding /
/LDFLAGS='-L/path/to/lib' \ /
/above the ./configure \ /

/For example is your libjpeg.so resides inside /usr/local/lib, you'd add/
/-L/usr/local./

/Once you've edited the file, remove config.cache and run ./config.nice,/
/after that make; make install; should work./

Since my/// libjpeg.so / is in /usr/lib I put/// LDFLAGS='-L/user' \/ - 
I still get the same error. If I compile without the jpeg it works like 
a charm - so I recompiled libjpeg thinking it may have gotten screwed 
up, but same errors.


So the question is, why can't it find these files?

Any ideas on what else I can do. I'm assuming that other people have 
this working on Slackware, if so, how did they do it? I posted to that 
forum as well and didn't get one answer.


Please always CC the list - you'll get more (and faster) help.

As David suggested, try adding this:

--with-jpeg-dir=/usr --with-png-dir=/usr

to the php configure command.

If that doesn't work, where is the jpeglib.h file?

Mine is in the /usr/include folder, so I use /usr for the 
--with-jpeg-dir parameter.


If that file doesn't exist anywhere on your system, you haven't got the 
headers installed for libjpeg.


--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD problems

2006-06-19 Thread Richard Lynch
On Mon, June 19, 2006 5:43 pm, Beauford wrote:
 I finally broke down and reinstalled PHP using the info from the site
 below,
 but GD is still not working. Phpinfo() shows it is enabled, as are the
 other
 libraries. So I'm lost as to what I am missing?

 http://tanksoftware.com/tutes/installingphp.html

If phpinfo() shows GD and all the cool libraries, then you're
definitely on the right track.

Now you just have to tell us what makes you think it's not working
and what you mean by not working and what your code looks like
and...

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] GD problems

2006-06-19 Thread Beauford
Hi again,

I started again to see if I could get it to work. I first removed everything
(libpng, libjpeg, zlib, and PHP). Then as before I followed the info in the
link below. Now I get the following when I run make for PHP. Note also that
I can not compile gd on it's own, I had to find a Slackware package for it.
Could this be the problem? Again, I have no idea what else to do as I have
followed all the info I could find on how to get this to work. I have also
included some info on gd below.

Thanks

 /home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c -o ext/gd/libgd/gd_jpeg.o  
echo  ext/gd/libgd/gd_jpeg.lo
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:38:21: jpeglib.h: No such file
or directory
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:39:20: jerror.h: No such file
or directory
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:49: error: parse error before
cinfo
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c: In function
`fatal_jpeg_error':
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:54: error: `cinfo' undeclared
(first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:54: error: (Each undeclared
identifier is reported only once
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:54: error: for each function
it appears in.)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c: At top level:
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:96: error: parse error before
cinfo
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c: In function `gdImageJpegCtx':
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:100: error: storage size of
`cinfo' isn't known
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:101: error: storage size of
`jerr' isn't known
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:104: error: syntax error
before row
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:105: error: `JSAMPROW'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:107: error: `JDIMENSION'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:107: error: parse error before
nlines
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:117: error: `row' undeclared
(first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:130: error: `JCS_RGB'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:133: error: `TRUE' undeclared
(first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:143: error: parse error before
_safe_emalloc
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:144: error: `JSAMPLE'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:145: error: `rowptr'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:150: error: `JPEG_LIB_VERSION'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:154: error: `JPEG_COM'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:171: error: `nlines'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:194:2: #error IJG JPEG library
BITS_IN_JSAMPLE value must be 8 or 12
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c: At top level:
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:230: error: parse error before
cinfo
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c: In function
`gdImageCreateFromJpegCtx':
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:240: error: storage size of
`cinfo' isn't known
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:241: error: storage size of
`jerr' isn't known
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:244: error: syntax error
before row
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:246: error: `JSAMPROW'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:246: error: parse error before
rowptr
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:249: error: `JDIMENSION'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:249: error: parse error before
nrows
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:260: error: `row' undeclared
(first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:276: error: `JPEG_APP0'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:278: error: `TRUE' undeclared
(first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:279: error: `JPEG_HEADER_OK'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:300: error: `JCS_CMYK'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:300: error: `JCS_YCCK'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:303: error: `JCS_RGB'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:330: error:
`jpeg_saved_marker_ptr' undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:330: error: parse error before
marker

Re: [PHP] GD problems

2006-06-19 Thread Chris

Beauford wrote:

Hi again,

I started again to see if I could get it to work. I first removed everything
(libpng, libjpeg, zlib, and PHP). Then as before I followed the info in the
link below. Now I get the following when I run make for PHP. Note also that
I can not compile gd on it's own, I had to find a Slackware package for it.
Could this be the problem? Again, I have no idea what else to do as I have
followed all the info I could find on how to get this to work. I have also
included some info on gd below.

Thanks

 /home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c -o ext/gd/libgd/gd_jpeg.o  
echo  ext/gd/libgd/gd_jpeg.lo
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:38:21: jpeglib.h: No such file
or directory
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:39:20: jerror.h: No such file
or directory



You need the libjpeg-devel, libpng-devel and so on packages to compile 
support for these into php. I don't know slackware, so they might be 
called -dev or something, but you need the dev packages which contain 
the header files.


--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] GD problems

2006-06-19 Thread Beauford
Thanks for the reply, but what are these for then - libpng and libjpeg? No
where does it say I need anything else. I have searched and searched for
information on installing this and never have I seen anything about -devel
packages. Even in the link I gave it says nothing about this. I've just
spent the last hour searching for these packages and can't even come close
to finding anything - all I get is the ones I've already installed, which
I'm thinking are one and the same - and they say Windows is bad. It only
took me 5 minutes in Windows to get this working.  As you can see I'm way
pass frustrated.

Thanks again

-Original Message-
From: Chris [mailto:[EMAIL PROTECTED] 
Sent: June 19, 2006 9:10 PM
To: Beauford
Cc: php-general@lists.php.net
Subject: Re: [PHP] GD problems

Beauford wrote:
 Hi again,
 
 I started again to see if I could get it to work. I first removed 
 everything (libpng, libjpeg, zlib, and PHP). Then as before I followed 
 the info in the link below. Now I get the following when I run make 
 for PHP. Note also that I can not compile gd on it's own, I had to find a
Slackware package for it.
 Could this be the problem? Again, I have no idea what else to do as I 
 have followed all the info I could find on how to get this to work. I 
 have also included some info on gd below.
 
 Thanks
 
  /home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c -o 
 ext/gd/libgd/gd_jpeg.o   echo  ext/gd/libgd/gd_jpeg.lo
 /home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:38:21: jpeglib.h: No 
 such file or directory
 /home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:39:20: jerror.h: No such 
 file or directory


You need the libjpeg-devel, libpng-devel and so on packages to compile
support for these into php. I don't know slackware, so they might be called
-dev or something, but you need the dev packages which contain the header
files.

--
Postgresql  php tutorials
http://www.designmagick.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD problems

2006-06-19 Thread Chris

Beauford wrote:

Thanks for the reply, but what are these for then - libpng and libjpeg? No
where does it say I need anything else. I have searched and searched for
information on installing this and never have I seen anything about -devel
packages. Even in the link I gave it says nothing about this. I've just
spent the last hour searching for these packages and can't even come close
to finding anything - all I get is the ones I've already installed, which
I'm thinking are one and the same - and they say Windows is bad. It only
took me 5 minutes in Windows to get this working.  As you can see I'm way
pass frustrated.


Some things you learn from experience or asking questions :)

It's reasonably standard if you want to compile something into another 
program, you need the headers (which are in the -devel package mostly). 
Databases are slightly different in that mysql and postgres (at least) 
give you a mysql_config and pg_config to tell you about different stuff.


This of course all depends on which system you are running. Most package 
based systems separate things out so the base package installs binaries 
only, and the -devel package installs headers and things you need to 
compile against it. Port systems (*bsd and gentoo for eg) of course are 
different again.


I thought php told you what you needed, I know some other programs will 
stop the configure script and say to compile support for X you need 
package Y installed. Obviously not..


--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] GD problems

2006-06-19 Thread David Robley
Beauford wrote:

 Thanks for the reply, but what are these for then - libpng and libjpeg? No
 where does it say I need anything else. I have searched and searched for
 information on installing this and never have I seen anything about -devel
 packages. Even in the link I gave it says nothing about this. I've just
 spent the last hour searching for these packages and can't even come close
 to finding anything - all I get is the ones I've already installed, which
 I'm thinking are one and the same - and they say Windows is bad. It only
 took me 5 minutes in Windows to get this working.  As you can see I'm way
 pass frustrated.
 
 Thanks again
 
 -Original Message-
 From: Chris [mailto:[EMAIL PROTECTED]
 Sent: June 19, 2006 9:10 PM
 To: Beauford
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] GD problems
 
 Beauford wrote:
 Hi again,
 
 I started again to see if I could get it to work. I first removed
 everything (libpng, libjpeg, zlib, and PHP). Then as before I followed
 the info in the link below. Now I get the following when I run make
 for PHP. Note also that I can not compile gd on it's own, I had to find a
 Slackware package for it.
 Could this be the problem? Again, I have no idea what else to do as I
 have followed all the info I could find on how to get this to work. I
 have also included some info on gd below.
 
 Thanks
 
  /home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c -o
 ext/gd/libgd/gd_jpeg.o   echo  ext/gd/libgd/gd_jpeg.lo
 /home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:38:21: jpeglib.h: No
 such file or directory
 /home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:39:20: jerror.h: No such
 file or directory
 
 
 You need the libjpeg-devel, libpng-devel and so on packages to compile
 support for these into php. I don't know slackware, so they might be
 called -dev or something, but you need the dev packages which contain
 the header files.
 
 --
 Postgresql  php tutorials
 http://www.designmagick.com/

Slackware installs these header files in /usr/include by default - you may
need to add to your configure the following:

--with-jpeg-dir=/usr --with-png-dir=/usr


/var/log/packages contains files for each package you have installed - those
files contain details of what was instaled where.

GD should compile just fine on Slack - it does for me so you may be missing
something iwhen you do configure for gd??

Cheers
-- 
David Robley

Funny, only sensible people agree with me.
Today is Sweetmorn, the 25th day of Confusion in the YOLD 3172. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] GD problems

2006-06-19 Thread Beauford
What surprises me about this is that no one in the various forums,
newsgroups, email lists, etc. can offer a solution. I'm sure I'm not the
only one that's had this problem. I can't even get an answer from the gd
forums or faq's.

I guess I'll have to see if I can find a captcha program that doesn't use
gd, or (shudder) move my web server to Windows.

Thanks again

-Original Message-
From: Chris [mailto:[EMAIL PROTECTED] 
Sent: June 19, 2006 10:14 PM
To: Beauford
Cc: php-general@lists.php.net
Subject: Re: [PHP] GD problems

Beauford wrote:
 Thanks for the reply, but what are these for then - libpng and 
 libjpeg? No where does it say I need anything else. I have searched 
 and searched for information on installing this and never have I seen 
 anything about -devel packages. Even in the link I gave it says 
 nothing about this. I've just spent the last hour searching for these 
 packages and can't even come close to finding anything - all I get is 
 the ones I've already installed, which I'm thinking are one and the 
 same - and they say Windows is bad. It only took me 5 minutes in 
 Windows to get this working.  As you can see I'm way pass frustrated.

Some things you learn from experience or asking questions :)

It's reasonably standard if you want to compile something into another
program, you need the headers (which are in the -devel package mostly). 
Databases are slightly different in that mysql and postgres (at least) give
you a mysql_config and pg_config to tell you about different stuff.

This of course all depends on which system you are running. Most package
based systems separate things out so the base package installs binaries
only, and the -devel package installs headers and things you need to compile
against it. Port systems (*bsd and gentoo for eg) of course are different
again.

I thought php told you what you needed, I know some other programs will stop
the configure script and say to compile support for X you need package Y
installed. Obviously not..

--
Postgresql  php tutorials
http://www.designmagick.com/

--
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] GD problems

2006-06-19 Thread Chris

Beauford wrote:

What surprises me about this is that no one in the various forums,
newsgroups, email lists, etc. can offer a solution. I'm sure I'm not the
only one that's had this problem. I can't even get an answer from the gd
forums or faq's.


I offered the solution - install the header files and you'll be able to 
compile.


--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD

2006-06-13 Thread Tom Ray [Lists]



Beauford wrote:

I'm using Slackware 10 and installed GD as an install package. I also
changed some lines in the php.ini file for GD.

Tom: I have no idea how this program works, all I know is that I need it for
the captcha program to display the image. I wouldn't even bother otherwise.

Thanks.

B

  
  
Well, do you know where it is installed? I have mine installed in 
/usr/local/gd so to test it I just ran gd2topng via 
/usr/local/gd/bin/gd2topng  it will ask for image information etc. If it 
does that then you're golden.


The downside is you will need to recompile PHP.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD

2006-06-13 Thread Richard Lynch
On windows, you just take out the ; in the line with php_gd2.dll in
your php.ini file

php.net has to be in the directory noted in ?php phpinfo();?

And your extension_dir in php.ini has to be the directory where
php_gd2.dll lives.

On Mon, June 12, 2006 6:11 pm, Beauford wrote:
 Hi,

 I am trying to get GD working so I can use a captcha script and not
 having
 much luck. I can get it to work in Windows, but not Linux.

 I have seen a few comments suggesting that PHP needs to be compiled
 with the
 GD switch. Is there another way to do this? I have PHP, MySQL and
 Apache
 installed and working great, I don't want to have to recompile PHP and
 have
 it screw up everything just for one program.

 Any help is appreciated.

 B

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD

2006-06-12 Thread Tom Ray [Lists]



Beauford wrote:

Hi,

I am trying to get GD working so I can use a captcha script and not having
much luck. I can get it to work in Windows, but not Linux. 


I have seen a few comments suggesting that PHP needs to be compiled with the
GD switch. Is there another way to do this? I have PHP, MySQL and Apache
installed and working great, I don't want to have to recompile PHP and have
it screw up everything just for one program. 


Any help is appreciated.

B

  
I would say this is more a GD issue than a PHP issue. Can you get GD to 
run from the command line?


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] GD

2006-06-12 Thread Ray Hauge
On Monday 12 June 2006 16:11, Beauford wrote:
 Hi,

 I am trying to get GD working so I can use a captcha script and not having
 much luck. I can get it to work in Windows, but not Linux.

 I have seen a few comments suggesting that PHP needs to be compiled with
 the GD switch. Is there another way to do this? I have PHP, MySQL and
 Apache installed and working great, I don't want to have to recompile PHP
 and have it screw up everything just for one program.

 Any help is appreciated.

 B

Depending on your Linux distribution, you might be able to find a GD module 
for PHP.  That way you don't have to re-compile PHP.  If you use an RPM based 
distro, this would be very easy.  Free-BSD you could just compile the port.

-- 
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
www.americanstudentloan.com
1.800.575.1099

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



  1   2   3   >