Lets say you have a group of photos from a location, shoot or event. They will be named depending on the camera something like DC001984 or IMG_02891 something like that anyway.
There is no real organisation and certainly no indicator to what they are without viewing the thumbnail. Here is some PHP code to mass rename the images which is perfect if you’re going to mass upload them and want the name to be reflective for what the image are of.
The code is this:
";//Some optional output }
Looping through all the images in the stated directory and renaming (using rename()) to what the $context is whilst adding the count value to the end of the file name to avoid “duplicates”.
Take this example of before:
to then after:
Then you can pick through the photos that will be used for SEO purpose and rename them to be more specific and identifying. Otherwise you now have photos that are named relevant and organised so much better than the default file naming.
A drained and empty Kennington reservoir images from a drone in early July 2024. The…
Merrimu Reservoir from drone. Click images to view larger.
Using FTP and PHP to get an array of file details such as size and…
Creating and using Laravel form requests to create cleaner code, separation and reusability for your…
Improving the default Laravel login and register views in such a simple manner but making…
Laravel validation for checking if a field value exists in the database. The validation rule…