BluApple Posted Tuesday at 12:12 PM Share Posted Tuesday at 12:12 PM I'm stuck on this code: <div class="gallery"><?php $images = glob(FOLDER A); foreach ($images as $i) { printf("<img src='FOLDER A...'>"); } ?></div> https://code-boxx.com/simple-php-image-gallery/ What needs to be replaced in "FOLDER A" do I need forward slashes? ("/") Tutorial here: https://code-boxx.com/simple-php-image-gallery/ Quote Link to comment https://forums.phpfreaks.com/topic/327568-trying-to-use-glob-function-to-create-gallery/ Share on other sites More sharing options...
Barand Posted Tuesday at 03:57 PM Share Posted Tuesday at 03:57 PM <?php $images = glob("path/to/folder a/*.*"); foreach ($images as $i) { echo "<img src='$i'>"; } Quote Link to comment https://forums.phpfreaks.com/topic/327568-trying-to-use-glob-function-to-create-gallery/#findComment-1653521 Share on other sites More sharing options...
BluApple Posted 14 hours ago Author Share Posted 14 hours ago Thank you Barand! It still gives a blank page though. Quote Link to comment https://forums.phpfreaks.com/topic/327568-trying-to-use-glob-function-to-create-gallery/#findComment-1653549 Share on other sites More sharing options...
gizmola Posted 13 hours ago Share Posted 13 hours ago When people are using tutorials to try and create PHP based features, there are pitfalls, the potential for misunderstandings and the possibility of error. We need to see what your actual code is. The only exception is in the case of passwords, keys etc. Those should be replaced. So we would need to see your code and the actual path you used in your code. The operating system, hosting location etc, is also important information in many cases. It sounds like you have error turned off at present, and for development, errors need to be turned on, so you can see what they are. It looks like your code has one or more errors in it, and that is why you are getting a blank page, but if errors are turned off, you can't see what the error message is. Quote Link to comment https://forums.phpfreaks.com/topic/327568-trying-to-use-glob-function-to-create-gallery/#findComment-1653550 Share on other sites More sharing options...
BluApple Posted 13 hours ago Author Share Posted 13 hours ago http://inflorescence.infy.uk/tryout.php Quote Link to comment https://forums.phpfreaks.com/topic/327568-trying-to-use-glob-function-to-create-gallery/#findComment-1653552 Share on other sites More sharing options...
Psycho Posted 8 hours ago Share Posted 8 hours ago First, your two includes at the top and bottom of the page are not within correct PHP tags. Need a ? before the starting PHP. The DIV in your code is in the HTML source, but there is nothing within it. That would seem to indicate that there was no content in the $images array. I'm guessing that the path you provided to the glob function is not correct. Where is the 'photography' folder in relation to where the php file is being executed? Quote Link to comment https://forums.phpfreaks.com/topic/327568-trying-to-use-glob-function-to-create-gallery/#findComment-1653555 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.