Jump to content

readfile inside a php script


MadnessRed

Recommended Posts

OK, I have a random image selector and I want it to get the image from a path specified by another file

 

here is my code at current

 

<a href="<?php readfile('data/profile/gallery.txt'); ?>" target="_new">
<?php
	//This will get an array of all the .jpg images in a folder
	$img_array = glob([color=red]readfile('data/profile/gallery.txt')[/color] . *.jpg");
	//Pick a random image from the array
	$img = array_rand($img_array);
	//Display the image on the page
	echo '<img alt="'.$img_array[$img].'" src="'.$img_array[$img].'" width=300 />';
?>
</a>

 

how should I be writing that?

Link to comment
https://forums.phpfreaks.com/topic/106677-readfile-inside-a-php-script/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.