Jump to content

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?
Link to comment
https://forums.phpfreaks.com/topic/15532-where-to-find-canned-png-images/
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.
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?
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.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.