I searched this site and found a very useful piece of code that I could use.
$counter = 0; foreach (glob("images/gallery/photo_gallery/resized/*.jpg") as $pathToThumb) { $filename = basename($pathToThumb); $pathToLarge = 'images/gallery/photo_gallery/' . $filename; echo ('<a href="'.$pathToLarge.'"><img src="'.$pathToThumb.'" /></a>'); $counter++; }
But for some reason this will only return the first 30 images in my directory. (there are 81) Can anyone think why this is happening?
Thank.
As I said above
$path = 'images/gallery/photo_gallery/resized/*';
will be sufficient. or, if you stubbornly want only jpg only,
$path = 'images/gallery/photo_gallery/resized/*.[Jj][Pg][Gg]';
as indicated in the manual
Thank you all for your input.
Here's the extension of the answers - CASE-SENSITIVE when used in glob () (something I didn't know about)
30 .jpg, .JPG
, , glob("imagesPath/*.jpg") .
glob("imagesPath/*.jpg")
:)
, - .:)
Source: https://habr.com/ru/post/1762045/More articles:https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1762040/no-handlers-matched-this-url-url-points-to-gwt-file&usg=ALkJrhj6Nw5Gs1X24XuU95jWv372ONvxdwhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1762041/how-to-better-transfer-objects-between-jersey-restful-enabled-classes-to-jsp-pages&usg=ALkJrhgu4w6yLJe5JcblWoDkUMemdkAHVgConvert character strings to R - data-structuresframe, stream and some other jargon in a ruby-debugging pearl, what do they mean? - ruby ββ| fooobar.comhandling multiple requests - multithreadingTesting if a line has a point in a triangle - geometryglibc detected - double free or corrupt - c#Define behavior in c - cHow to place a background image from the center? - cssBeanNotOfRequiredTypeException with Spring AOP - javaAll Articles