graham23s Posted July 4, 2008 Share Posted July 4, 2008 Hi Guys, on one of my sites i have a folder of images, i was wanting to read and loop through these images displaying random ones from another one of my sites! so www.site1.com/images/images.jpg read and display these on www.site2.com is that possible? cheers guys Graham Link to comment https://forums.phpfreaks.com/topic/113267-looping-through-a-folder-of-images/ Share on other sites More sharing options...
ratcateme Posted July 4, 2008 Share Posted July 4, 2008 you could put all the images in a database on site2 then when you want pick some random rows then show them using <img> tags Scott. Link to comment https://forums.phpfreaks.com/topic/113267-looping-through-a-folder-of-images/#findComment-581943 Share on other sites More sharing options...
taith Posted July 4, 2008 Share Posted July 4, 2008 or... just $imgs=glob('imagefolder/*.jpg'); $img=$imgs[array_rand($imgs)]; Link to comment https://forums.phpfreaks.com/topic/113267-looping-through-a-folder-of-images/#findComment-581945 Share on other sites More sharing options...
DarkWater Posted July 4, 2008 Share Posted July 4, 2008 @taith: No, they're on different servers. Link to comment https://forums.phpfreaks.com/topic/113267-looping-through-a-folder-of-images/#findComment-581949 Share on other sites More sharing options...
br0ken Posted July 4, 2008 Share Posted July 4, 2008 If the two sites are both based on the same server then by configuring the permissions you can do this however like DarkWater says, if they're on different servers you can't do it. One way around it is on the site with the images, you could add all of their names to a CSV (comma seperated values) file and then grab that using file_get_contents, process it voilla, you have your images! Link to comment https://forums.phpfreaks.com/topic/113267-looping-through-a-folder-of-images/#findComment-581976 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.