Jump to content

Generated Images within Div tag


debug

Recommended Posts

Hi-

 

Yesterday I wrote a quick script to generate an image using the GD graphics library and it works great however now when I try to put the code into a Div tag I'm getting a error stating that the header has already been set and then it churns out a load of garbage (which I assume is the png file in its raw format).

 

any ideas how I could embed my generated image into a div tag?

 

Thanks

Link to comment
Share on other sites

If you look in the PHP that generates your image, you should see a line similar to:

 

header("Content-Type: image/png");

 

This is defining the content type as an image, half way through the file, which obviously the surrounding HTML is definitely not. You need to include the generated image externally, which you can do using the HTML <img> tag, like so:

 

<img src="gen_img.php" alt="" />

 

Just place the PHP that generates the image within the "gen_img.php" file (or whatever you wish to call it).

 

By the way this isn't a JavaScript problem...

 

Adam

Link to comment
Share on other sites

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.