PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Fri Aug 17, 2018 2:40 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Sat Jul 18, 2009 9:29 am 
Offline
Forum Contributor

Joined: Fri May 28, 2004 2:37 am
Posts: 158
Hi All,
I've got a little question about ImagePng. I've read a lot of threads and I've been storing a Png image in a variable with ob_start();. It's a bit hard to explain what I want to do, but I'll give it a try. Because I am using this GD function dynamically I want to print out the contents of the variable to screen inside a <DIV> tag, however it needs to represent itself as an image. How would I print the contents of my variable (which holds the full GD PNG image) into a html page without first saving it to a file? Can I use header types inside my DIVS?

Thanks for any help... :)


Last edited by dreamline on Mon Jul 27, 2009 6:57 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Sat Jul 18, 2009 12:06 pm 
Offline
DevNet Resident
User avatar

Joined: Sun Feb 15, 2009 8:22 pm
Posts: 2119
Location: Ipswich, UK
You have to link to a seperate file.

You could do it in one file like this though:

Syntax: [ Download ] [ Hide ]
 
if(!isset($_GET['blah']))
echo '<img src="'.htmlentities($_SERVER['PHP_SELF']).'?blah=1" />';
else
{
//do all your image stuff
}
 


Top
 Profile  
 
PostPosted: Sat Jul 18, 2009 9:49 pm 
Offline
Forum Contributor

Joined: Fri May 28, 2004 2:37 am
Posts: 158
Hi,
Thanks jackpf, it was not the answer I was hoping for because I don't want to write to file and want to output directly in my html page. I guess I will need to create all my text images by hand instead of creating them through imagePNG and then printing it in a html tag.

Thanks for your answer. :)


Top
 Profile  
 
PostPosted: Sun Jul 19, 2009 6:50 am 
Offline
DevNet Resident
User avatar

Joined: Sun Feb 15, 2009 8:22 pm
Posts: 2119
Location: Ipswich, UK
I think you misunderstood...you don't have to write anything to a file.

Obviously to link to an image, you have to use an <img> tag. But you need a file to display the image as well.

By doing as I suggested, one file can act as both the picture, and the script that displays it.

Is that not what you wanted?


Top
 Profile  
 
PostPosted: Sun Jul 19, 2009 8:10 pm 
Offline
Forum Contributor

Joined: Fri May 28, 2004 2:37 am
Posts: 158
Yes, that's exactly what I want. I guess I did misonderstood. So I'll give it a go to see if I can manage to print to a <img> tag.. :)

Thanks and sorry I misunderstood.


Top
 Profile  
 
PostPosted: Mon Jul 20, 2009 3:37 am 
Offline
DevNet Resident
User avatar

Joined: Sun Feb 15, 2009 8:22 pm
Posts: 2119
Location: Ipswich, UK
Lol no problem. Good luck.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group