homepage Welcome to WebmasterWorld Guest from 54.166.128.254
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
PHP file that is included into img src html code howto?
ball4121

5+ Year Member



 
Msg#: 11547 posted 11:23 pm on Jan 26, 2006 (gmt 0)

Can't find it on google. What I want is a php file to work in <img src="url.php">

And it show up in when put on an html page

I'm wanting to use it for google ads basically saying url.php has the google ad code, and when the image source html code is applied... It appears.

Thank you.

 

LeChuck

5+ Year Member



 
Msg#: 11547 posted 11:39 pm on Jan 26, 2006 (gmt 0)

Maybe do this instead of your image tag:

<?php include "/path/to/adsense.txt";?>

with adsense.txt containing your whole adsense <script>.

newbie2006

5+ Year Member



 
Msg#: 11547 posted 11:47 pm on Jan 26, 2006 (gmt 0)

it is not clear, what kind of problem you are try to solve.
Your script does not show the image?
You are trying to load remote image and display it?
or what exactly? Could you please describe the problem

ball4121

5+ Year Member



 
Msg#: 11547 posted 12:36 am on Jan 27, 2006 (gmt 0)

Ok lets say I wanna use
<img src="url.php">
and url.php is what i'm focusing on.

In url.php I put the google ad script.

But it will not work is there something i'm missing?

I wanted to try on my forums and see if I could paste the html snippet (<img src="url.php">) and see if my adsense ad appeared.

coopster

WebmasterWorld Administrator coopster us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 11547 posted 1:06 am on Jan 27, 2006 (gmt 0)

Are you saying you want to include an image that is fetched through PHP code? It certainly seems that way if you are pushing it out through and <img> element. And if so, perhaps this thread will help:

How to convert image blob files back to image [webmasterworld.com]

And hey, welcome to WebmasterWorld, newbie2006 ;)

grandpa

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 11547 posted 4:49 am on Jan 27, 2006 (gmt 0)

It sounds to me like you're trying to include the adsense code with the image tag. Why not just use include?

<?php
include ("path/to/url.php");
?>

newbie2006

5+ Year Member



 
Msg#: 11547 posted 4:59 pm on Jan 27, 2006 (gmt 0)

grandpa,
<?php
include ("path/to/url.php");
?>

For use this part of code that in some file, this file has to be work by php, simple .html will not work with it. It has to be either .phtml, .php or somethign that work through php.

henry0

WebmasterWorld Senior Member henry0 us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 11547 posted 5:34 pm on Jan 27, 2006 (gmt 0)

Why not having HTML parsing PHP
using " .htaccess "
try one line or the other

AddHandler application/x-httpd-php .html
OR
AddType application/x-httpd-php .html

OR
set it up in httpd.conf
find that line:
AddType application/x-httpd-php .php
add .html to the end
AddType application/x-httpd-php .php .html
if you do not have root access ask your ISP to perform it on your behalf.

newbie2006

5+ Year Member



 
Msg#: 11547 posted 6:04 pm on Jan 27, 2006 (gmt 0)

henry0, do not mislead the man.
WHat for to do the include, what for to make any changes in the apach configuration?
If he/she has the windows server!

The method that ball4121 used is full logical and full correct. In real the question is in what exactly the php file has to print and where from to take the data for it.

If ball4121 just could not print file from binar, then your method will not solve the problem, but only bring more troubles.

henry0

WebmasterWorld Senior Member henry0 us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 11547 posted 6:18 pm on Jan 27, 2006 (gmt 0)

What misleading?
the post is not clear!
I did think that the poster was trying to parse PHP via HTML

ARE YOU THE MIRADOR KEEPER

jatar_k

WebmasterWorld Administrator jatar_k us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 11547 posted 6:19 pm on Jan 27, 2006 (gmt 0)

well, let's all take a moment here, we should all know the adage about "nothing nice to say..."

ball4121, if you are going to have a php script in an image tag, then that php script has to return an image. If you are trying to get anything else besides an image in there then it isn't going to work.

if you are trying to include some kind of generated output that isn't an image and you don't want to put the code right into your page then the option of using an include is the right one and you will have to make the page parsable for php.

henry0 mentioned above how to do that on apache, if you are using IIS then you will have to do some searches to figure out how that is done.

I don't see why you can't just put the ad code right into your html page. I am guessing that you can then include it across all pages but not really sure if that is why.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved