Hi there,
Maybe you want to this.
Trick here is that you check if each file you're getting from the directory resource is a jpg file or not by looking at the last three characters of it (with
substr()). It doesn't check the actual file type, so even if it's an myapp.exe file renamed as myapp.jpg, this code will pick it up.
Stefan's is to filter the non-jpg files BEFORE putting them into the directory resource, while mine is AFTER. Ideally, you should go with Stefan's, because it's less memory consuming, depending on how many non-jpg files you are looking at. (but mine also works on Windows...!)