Welcome to WebmasterWorld Guest from 54.144.124.152

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

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

     

ball4121

11:23 pm on Jan 26, 2006 (gmt 0)

5+ Year Member



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

11:39 pm on Jan 26, 2006 (gmt 0)

5+ Year Member



Maybe do this instead of your image tag:

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

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

newbie2006

11:47 pm on Jan 26, 2006 (gmt 0)

5+ Year Member



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

12:36 am on Jan 27, 2006 (gmt 0)

5+ Year Member



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

1:06 am on Jan 27, 2006 (gmt 0)

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



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

4:49 am on Jan 27, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



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

4:59 pm on Jan 27, 2006 (gmt 0)

5+ Year Member



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

5:34 pm on Jan 27, 2006 (gmt 0)

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



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

6:04 pm on Jan 27, 2006 (gmt 0)

5+ Year Member



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

6:18 pm on Jan 27, 2006 (gmt 0)

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



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

6:19 pm on Jan 27, 2006 (gmt 0)

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



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.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month