Jump to content

Archived

This topic is now archived and is closed to further replies.

m august

Where to find Canned PNG images

Recommended Posts

If one wants to use canned PNG images in ImageCreateFromPNG() functions, where does one find them? Are they already in the GD library somewhere? If I simply type in ImageCreateFromPNG('button.png'), for example, no such file is found. Do I have to copy such a dummy from somewhere into my own htdocs file? Where do I look for things like canned, unadorned button images?

Share this post


Link to post
Share on other sites
I don't fully understand your definition of 'canned' images, but the function imagecreatefrompng() is used to create a new image, but starting with the canvas filled with the contents of an existing image, defined only parameter in the function.

Share this post


Link to post
Share on other sites
Exactly. That's what I'm referring to. I created my own button.php file in my htdocs directory. It is inside button.php that I call the ImageCreateFromPHP() function with argument 'button.png'. No, I do not have a button.png in my htdocs file, and the <image src= "button.php"> tag is in a separate, initial page in htdocs that does successfully invoke button.php which is also in htdocs. Naturally, my php error.log file says:


PHP Warning:  imagecreatefrompng(button.png)
[<a href='function.imagecreatefrompng'>function.imagecreatefrompng</a>]:
failed to open stream: No such file or directory in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\button.php on line 3

I'm not surprised I got this message because I simply inserted the
ImageCreateFromPNG('button.png') call using an example from Lerdorf's 'Programming PHP' O'Reilly book, hoping that such a file might be in the GD libraries. I have T1Lib and FreeType and PNG support all enabled for GD. Surely there are dummy button images already sitting in the GD libraries - or somewhere. What path do I use to get to them?

Share this post


Link to post
Share on other sites
No, as far as I'm aware, there are no dummy/included images packaged with the GD library.

Share this post


Link to post
Share on other sites
Maybe you are trying to create a new image to start on, are you?
In that circumstance you use [b]imagecreate[/b] with the width/height and then you only have to tell it what type it is when you output, such as:
imagepng,imagegif,imagejpg etc.

Share this post


Link to post
Share on other sites
do a google search for 'free button graphics'

I found this link right away:

http://www.freebuttons.com/index.php?page=freebuttons

-if they are in some other graphics format like .jpg, just convert them to .png

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.