By odyseg on
Hi,
I am creating a custom page using the php input format.. now I'm using this 'imagecreatefrompng' function the generate an image, but drupal is prompting me an error..
'warning: imagecreatefrompng(images/catsample.png) [function.imagecreatefrompng]: failed to open stream: No such file or directory in /var/www/html/home2/includes/common.inc(1352) : eval()'d code on line 2.'
is there any way I can use this function on drupal?
thank you in advance..
Comments
Just give it the correct argument
You can use the function just fine, only you'd need to use it correctly.
In this case by giving it the correct path to the file you are trying to open. That error says "No such file or directory".
Based on the code you've given here (if you haven't modified it yourself) in looks like you've omitted the path to the files directory.
You could just enter the full path, but to be portable:
Should do it for you. Assuming you put the file in sites/{sitename}/images like I'm guessing here.
http://api.drupal.org/api/group/file/6
.dan. is the New Zealand Drupal Developer working on Government Web Standards
Wow it work.. thank you very
Wow it work.. thank you very much.. looks like i'm the one who's really doing the wrong move..
thanks for the additional.. ^_^
w8 i had another error when
w8 i had another error when i'm putting the header for the image
header("Content-type: image/png");
it says it cannot be displayed because it contain an error...
header("Content-type: image/png");
imagepng( $myimg );
imagedestroy($myimg);
:-(
You're not providing enough information to really help, but I think you've got a misunderstanding about how image generation will work.
You can't just create an image on the fly in the middle of a PHP page and get it to display. HTML and HTTP can't work that way, whether using Drupal or not.
You cannot set_header inside a Drupal php page content - that is an error, Drupal page content is wrapped in the HTML navigation - you can't output binary image data there.
This is not a Drupal issue, you'll have to research a bit more about PHP, HTML and HTTP first.
I think that what you are doing is probably too difficult.
A work-around is probably possible, but you need to be very very tricky.
.dan. is the New Zealand Drupal Developer working on Government Web Standards