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."
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" /> PHP: 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.
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