PHP to perl-Help !

Hi

I found the following programs in PHP and I want to understand them to convert them to perl. Does any one know how to convert them please. Thanks
ImageCreate ??
ImageColorAllocate ??
ImageFilledRectangle ??
etc ??



/* create GIF file */

$im - ImageCreate (420,420);
$white = ImageColorAllocate ($im,255,255,255);
$black = ImageColorAllocate ($im,0,0,0);
$red = ImageColorAllocate ($im,255,10,10);
$green = ImageColorAllocate ($im,10,255,10);
$blue = ImageColorAllocate ($im,10,10,255);
$yellow = ImageColorAllocate ($im,255,255,0);
$y1 = ImageColorAllocate ($im,255,255,0);
$y2 = ImageColorAllocate ($im,255,220,0);
$y3 = ImageColorAllocate ($im,255,150,0);
$y4 = ImageColorAllocate ($im,255,20,0);

/* draw a legend */

ImageString ($im,5,10,20,"X county, state", $black);
ImageFilledRectangle ($im,10,280,20,290,$y1)
ImageFilledRectangle ($im,110,280,120,290,$y2)
ImageFilledRectangle ($im,210,280,220,290,$y3)
ImageFilledRectangle ($im,310,280,320,290,$y4)
ImageFilledRectangle ($im,2,10,300,less than 5,000",$black)
etc...
nawafAsked:
Who is Participating?
 
rycamorConnect With a Mentor Commented:
The code above is part of an extension to PHP to interface with the GD graphics library ( www.boutell.com/gd ). This is not part of the core language, so there will not be a direct mapping to similar Perl functions.

Perl has a library for handling GD, though, called GD.pm, which you can see at http://search.cpan.org/search?dist=GD . Be aware that you also have to install GD itself on your system.


It should be pretty easy to identify which functions do the same as the above PHP functions you quote, because they derive from the GD API.

I will mention also, that with PHP or Perl, the latest version of the GD image handler will NOT produce gif images, only PNG, Jpeg and others. This is because GD itself now doesn't handle gif output, due to copyright issues with Unisys, the patent holder for LZW compression. If you want to create a gif image, you need version 1.3 of GD and an older version of GD.pm.
0
 
ykf2000Commented:
I think you'll have to have a graphics library in Perl to do this.
0
 
MoondancerCommented:
It's time to clean up this topic area and that means taking care of this question. Your options at this point are:

1. Award points to the Expert who provided an answer, or who helped you most. Do this by clicking on the "Accept Comment as Answer" button that lies above and to the right of the appropriate expert's name.

2. PAQ the question because the information might be useful to others, but was not useful to you. To use this option, you must state why the question is no longer useful to you, and the experts need to let me know if they feel that you're being unfair.

3.  Ask Community Support to help split points between participating experts.  Just comment here with details.

4.  Delete the question because it is of no value to you or to anyone else.  To use this option, you must state why the question is no longer useful to you, and the experts need to let me know if they feel that you're being unfair.

If you elect for option 2, 3 or 4, just post comment with details here and I'll take it from there.  We also request that you review any other open questions you might have and update/close them.  Display all your question history from your Member Profile to view details.

PLEASE DO NOT AWARD THE POINTS TO ME.

____________________________________________



Hi Experts:

In the event that the Asker does not respond, I would very much appreciate your opinions as to which Expert ought to receive points (if any) as a result of this question.  Likewise, you can also suggest that I PAQ or delete the question.

Experts, please do not add further "answer" information to this question.  I will be back in about one week to finalize this question.

Thank you everyone.

Moondancer :)
Community Support Moderator @ Experts Exchange

P.S.  REGARDING POINTS, Guidelines and more:  http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp  
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.