Page 1 of 1

PhpCode

Posted: Mon Jun 30, 2014 10:18 am
by Rubel Rana

Code: Select all

<?php


$total = "3";

// Change to the type of files to use eg. .jpg or .gif
$file_type = ".jpg";

// Change to the location of the folder containing the images
$image_folder = "random";

// You do not need to edit below this line

$start = "1";

$random = mt_rand($start, $total);

$image_name = $random . $file_type;

echo "<img src=\"$image_folder/$image_name\" alt=\"$image_name\" />";


?>


My question is if i run this code,in browser it just show the image name,not the image , what is the wrong with the code?? I want to show the images..

Re: PhpCode

Posted: Mon Jun 30, 2014 10:41 am
by Celauran
Have you checked what is being output? Confirmed that the path exists as specified?

Re: PhpCode

Posted: Mon Jun 30, 2014 10:50 am
by Rubel Rana
Thx i fixed it.