$files = scandir('folder/');
foreach($files as $file) {
//do your work here
}
or glob may be even better for your needs:
$files = glob('folder/*.{jpg,png,gif}', GLOB_BRACE);
foreach($files as $file) {
//do your work here
}
More Related Contents:
- How do I use filesystem functions in PHP, using UTF-8 strings?
- How to delete a folder with contents using PHP [duplicate]
- Get the hierarchy of a directory with PHP
- Echo in an image
- Saving image from PHP URL
- open_basedir restriction in effect. File(/) is not within the allowed path(s):
- Can I store images in MySQL [duplicate]
- How do I convert a PDF document to a preview image in PHP?
- Full Secure Image Upload Script
- How to get directory size in PHP
- Listing all the folders subfolders and files in a directory using php
- Merging two images with PHP
- Resize animated GIF file without destroying animation
- Create a folder if it doesn’t already exist
- PHP Data-URI to file
- Best way to get files from a dir filtered by certain extension in php [duplicate]
- How can I use PHP to check if a directory is empty?
- How to embed images in html email
- How to reduce the image size without losing quality in PHP [closed]
- How to display an BLOB image stored in MySql database?
- A recursive remove directory function for PHP?
- Scale Image Using PHP and Maintaining Aspect Ratio
- php resize image on upload
- PHP – Convert File system path to URL
- How to check if directory contents has changed with PHP?
- How do you convert an image to black and white in PHP
- PHP – Create simple animated GIF from two JPEG images? [closed]
- Merge two PNG images with PHP GD library
- Merge two images in php
- How to stop PHP iMagick auto-rotating images based on EXIF ‘orientation’ data