Jump to content

Recommended Posts

You have two main options off the top of my head.

 

You can base64 encode the image an put it directly into the HTML document. This is perfectly acceptable for small images.

 

<?php
// Not tested
$image = base64_encode($row['image']);
$output = 'data:image/jpg;base64,' . $image;
?>

<img src="<?php echo $output ?>" />

 

Or you will have to create a separate script and set the content type in a header. Then you would link to the script in the src attribute.

 

<?php
// Not tested
$image = $row['image']; 
header("Content-type: image/jpg");
echo $image; 

 

Or you could write the image to the filesystem, which I doubt you want to do.

Thanks Gibbs...I'll give that a try and see how I get on.

 

Is it possible to capture the output of a browser window, say as a screen shot?

 

Simon

 

I have done this before but not in PHP. I don't think it would be possible in PHP unless you are allowed to use some dangerous functions such as exec. That would still rely on external software though.

Wait a sec, you say you are already creating the image. How are you creating it now and how are you using it? If you already have an image resource you can create a Jpeg or Gif using imagejpeg() or imagegif(), respectively.

 

Not sure why you are wanting to get a screenshot of the users browser. That's not possible without some client-side code that would require installation by the user and, most likely for the user to lower their security settings.

Thanks for your reply.

 

What I have is a base map over which I then place weather icons using PHP.

 

It is this resulting 'image' (which of course is not an image at all really) that I want to output as a gif or jpg.

 

Hope that makes more sense?

 

Thanks again,

Simon

using gd you can overlay images and save or display the result

 

Yeah, what he said. You can create a "real" image using the same type of logic you are using now - one image as the based and then placing other images on top. You'll have to do some research though. I've not worked with images a lot so I can't give a lot of pointers. But, if the icons are not rectangular then you will want the source image to have transparency as needed.

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.