frost Posted August 8, 2007 Share Posted August 8, 2007 I have this issue seeing php manipulated images locally. Below is a file called random.php I call on it like so - <img src="images/random/random.php?pic=random"> This works peachy online but it just shows a broken image locally. <?php //read folder $folder=opendir("."); while ($file = readdir($folder)) $names[count($names)] = $file; closedir($folder); //sort file names in array sort($names); //remove any non-images from array $tempvar=0; for ($i=0;$names[$i];$i++){ $ext=strtolower(substr($names[$i],-4)); if ($ext==".jpg"||$ext==".gif"||$ext=="jpeg"||$ext==".png"){$names1[$tempvar]=$names[$i];$tempvar++;} } //random srand ((double) microtime() * 10000000); $rand_keys = array_rand ($names1, 2); //random image from array $slika=$names1[$rand_keys[0]]; //image dimensions $dimensions = GetImageSize($slika); if (isset($pic)){header ("Location: $slika");} else {echo "<img src=\"$slika\" $dimensions[3]>";} ?> Things I have thought of: - images in the correct directory for the file to read, check. - GD library? check - from phpinfo > "GD Support enabled" Is there something else I can look at? Thanks! Link to comment https://forums.phpfreaks.com/topic/63984-localhost-php-strangeness/ Share on other sites More sharing options...
lemmin Posted August 8, 2007 Share Posted August 8, 2007 Is it localhost, or is it just clicking on a html file that has that image source? If you are opening an html file with ie it wont run the php. Link to comment https://forums.phpfreaks.com/topic/63984-localhost-php-strangeness/#findComment-318954 Share on other sites More sharing options...
frost Posted August 9, 2007 Author Share Posted August 9, 2007 It is a PHP file for sure. The same exact file that I upload to my host (which then works) Link to comment https://forums.phpfreaks.com/topic/63984-localhost-php-strangeness/#findComment-318957 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.