Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

hansolo669

macrumors regular
Original poster
Oct 5, 2009
201
0
i have searched around to no avail. essentially what i want to do is have the url variable (?1 ?234 ?2534753 what ever it is) store itself in a php variable which would then inject itself into an html image tag loading the image with the corresponding number (i.e "www.image.com?1" would load "1.jpg" into the page)

my code (for this part) as it stands looks like this
Code:
<? if (!empty($_SERVER["QUERY_STRING"])) ?>
<? $img_name = QUERY_STRING ?>
<img src= "<? echo $img_name ?>" width="1024" height="768"/>
 
I believe the route I'd take would be more like:
PHP:
<?php
$img_path = 'images/';
if (isset($_GET['image'])){
	$img_name = $img_path . $_GET['image'];
	list($width, $height, $type, $attr) = getimagesize($img_path.'image_name.jpg');
}
?>
<img src= "<?=$img_name?>" <?=$attr?> />
(i.e "www.image.com?image=1.jpg" would load "1.jpg" into the page)

Of course that would need to be tweaked depending on your image directory location.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.