Problem Mortgage - Loans - Myspace Layouts - Mortgage - Send Telegram

PDA

View Full Version : I need to display pictures with ads around them (showpic.php)


smi
Mar 5th 2007, 6:42 am
I want to store all images in a folder and when I want to display them I just link to: showpic.php?img=image001.jpg

In the showpic.php file I can have phpads or other ad solutions in order to display ads to everyone who view the images.

I have seen such a solution on various celebrity blogs and other sites. Is there any script or code available? I have googled extensively but only succeeded in finding plenty of "randomizers."

nico_swd
Mar 5th 2007, 7:37 am
Create the showpic.php page, and somewhere there put:



<?php

$path = './images/'; // Path to images

$image = htmlentities(basename(rawurldecode($_GET['img'])));

if (!file_exists($path . $image))
{
$image = 'error.jpg';
}

?>
<img src="images/<?php echo $path . $image; ?>" border="0" />


Now place your ads around there, wherever you need them, and you're basically done. The image source will be what is given in the URL.

smi
Mar 6th 2007, 4:00 am
Thank you very much for your help.

donthate
Mar 6th 2007, 9:03 pm
Or use this, would work fine.

<?
$img = $HTTP_GET_VARS['img'];
echo "ads above image<br>";
echo "<img src='http://www.yoursite.com/images/$img'></img><br>";
echo "ads below image<br>";
?>


then link to ( saying above file is showpic.php ) -

http://www.yoursite.com/showpic.php?img=mycoolpic.jpg

its EXACTLY what you need, just change yoursite to your domain/url in the script.

enjoy