Forum Moderators: coopster

Message Too Old, No Replies

PHP Dynamic Web Graphics

Creating background images, rounded cornered boxes & text-headings with PHP

         

cosmoyoda

7:05 am on Nov 27, 2007 (gmt 0)

10+ Year Member



<?php echo "Hello World!"?>

One of the hardest problems I am having right now is finding an efficient way to create dynamic images on my PHP/MySQL website that will be easy to create ( I want to create images on the fly) and cross-browser compatible.

Of course, dealing with images is always a good thing, because any browser can support it, so I believe I should do this instead of SVG or sIFR, which are not widely supported.

I am aware that if I use PNG images with alpha transparency (which I will! =) ) it will look weird in IE 6 because of the PNG bug, but I can fix this with a javaScript file that can fix it for IE6 users.

I was wondering if any of you know how I can accomplish this? Do you know any good script out there that will let me, for instance, take a font file, store on my server and then deliver to the user the dynamic text in the format of an image (PNG, probably), so that he can see it?

Thank you for your support. Any help is highly appreciated!

Cosmoyoda

eelixduppy

7:36 am on Nov 27, 2007 (gmt 0)



First take a look at the Image Functions [us2.php.net] documentation. This will familiarize you with the basic functions needs to accomplish your task; you might even be able to do what you want from just the example code they give you in the documentation.

But, however, if you want something more advances a quick google search will probably yield someone's already coded solution for you to fiddle with. If you'd like help on a specific image manipulation problem, don't be shy and ask :)

tomda

10:00 am on Nov 27, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As Eelixduppy said, start from the basic using a tutorial... GD functions are easy to use and learn.

I made several functions such as transparent rounded corners, the only problem I had was the fact that large PNG pictures generated with alpha transparency were very very heavy, too heavy to my taste...

cosmoyoda

11:38 pm on Dec 28, 2007 (gmt 0)

10+ Year Member



GD Functions are awesome. Thanks! I tried using ImageMagick for PHP, but it is almost impossible for a beginner like me to understand how to use it. The IamgeMagick function library is barely well documented on the PHP.net website, so I guess it's not the right time for me to use ImageMagick.

eelixduppy, I wonder how you could do nice transparent rounded corners only using GD images. If you could share a link with a good tutorial or something or let me know if it was too hard to accomplish this it would be a big help! It would be wonderful to stop using Photoshop to create many many images for my site, that would save a lot of time if I could create them dynamically.

Thanks a lot!

coopster

1:09 pm on Jan 1, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Imagick Image Library [php.net]

This extension is EXPERIMENTAL

When you see those big WARNINGS, you need to take heed. You are correct in that these functions are not well documented or possibly even stable yet, but the WARNING tells you so right off the bat. The best way to employ the functions today is to (carefully) use system commands to manipulate your images. And the best documentation is the Imagick web site itself.

cosmoyoda

6:14 pm on Jan 1, 2008 (gmt 0)

10+ Year Member



My point exactly. However, can you tell me what software I need to use the commands in the ImageMagick website? It looks like Perl, but I'm not sure what code it is. I've seen the website and I believe its incredibly well documented. Although they do not have the code in PHP. Is there a way to convert that code to PHP?

Happy New Year!

coopster

2:19 pm on Jan 2, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



ImageMagick is the software. The commands are part of the package. You would execute the commands via one of PHP's Program Execution Functions [php.net]. Here are a couple of old threads I found that demonstrate ...

[webmasterworld.com...]
[webmasterworld.com...]

cosmoyoda

7:08 pm on Jan 2, 2008 (gmt 0)

10+ Year Member



Oh now things are making more sense to me now. PHP has Program Execution Functions, so thats how experienced developers execute non-PHP commands like the ones inside ImageMagick.

Thank you so much for those links. Now I think I have everything I need to start learning PHP with ImageMagick. Thank you!