|
|||||||
New to SitePoint Forums? Register here for free!
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
SitePoint Guru
![]() ![]() ![]() ![]() ![]() Join Date: Oct 2004
Location: Austin Texas
Posts: 666
|
gd functions! Is there anyway to produce and image display an image withou saving it?
Right now this is what I'm doing ....
PHP Code:
without first saving it to a file? Last edited by ikeo; Jul 19, 2006 at 03:52. |
|
|
|
|
|
#2 | |
|
SitePoint Member
Join Date: Jul 2006
Location: Ukraine
Posts: 3
|
Quote:
|
|
|
|
|
|
|
#3 |
|
SitePoint Guru
![]() ![]() ![]() ![]() ![]() Join Date: Oct 2004
Location: Austin Texas
Posts: 666
|
I've tried that before and it won't work if I put it in an html page.
It just spits out gobbledy gook .. |
|
|
|
|
|
#4 | |
|
SitePoint Enthusiast
![]() Join Date: Dec 2005
Location: UK
Posts: 83
|
Quote:
What you need to do is create a script that ONLY outputs an image, and then call it using <img src="myimage.php"> in your HTML. |
|
|
|
|
|
|
#5 | |
|
SitePoint Guru
![]() ![]() ![]() ![]() ![]() Join Date: Oct 2004
Location: Austin Texas
Posts: 666
|
thanks onion2k,
The approach in the code I posted works for me, but I was hoping I could just assign the image I created to .... say Quote:
so maybe what I want isn't possible ... Thanks for the help. |
|
|
|
|
|
|
#6 |
|
Follow Me On Twitter: @djg
![]() ![]() ![]() ![]() ![]() Join Date: Aug 2000
Location: Philadephia, PA
Posts: 19,741
|
No, doesn't make sense in the context of how webpages work. You either need to write it to a file and write out an <img> tag pointing to that new file, or write an <img> tag pointing to a PHP script which outputs the new image.
SitePoint has a tutorial on CAPTCHA scripts too. A search for "security image" may bring it up. |
|
|
|
|
|
#7 |
|
SitePoint Wizard
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Oct 2002
Location: Scotland
Posts: 2,936
|
The fundamental issue here is as Dan pointed out - an image is just a collection of binary data. When you put an image in a web page, you don't actually put the image there, you put a link/pointer to the image then the browser follows that link, fetches the image and displays it.
If PHP is to create the image then the process is no different - you put the link/pointer to the PHP file in the web page. The only difference is that instead of an actual physical image being fetched by the browser, it fetches the output of that PHP file (with the appropriate header() info). |
|
|
|
![]() |
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
|
All times are GMT -7. The time now is 22:27.














Linear Mode
