Field to select registered image sizes within the WordPress dashboard.
How to Use
Once activated, this plugin will create a Image Size field type in ACF. This field type will list all registered field types as a drop down within the field group.
To use this field within your custom templates you will use the following code:
$my_image_id = get_field('my_image_id'); // ACF Image return type set to ID for this demo
$my_image_size = get_field('my_image_size'); // The selected image size (eg. large)
echo wp_get_attachment_image( $my_image_id, $my_image_size ); // Output the image based on the ID, and the Image Size selected.
This php photo gallery script will quickly and easily create a photo gallery from a folder of image files. It will resize (or cropped) thumbnails and cache them for quick access.
Creating image galleries can be time-consuming, and other gallery scripts don’t allow for flexibility or are too bloated for everyday use. The goal with this script was to create an easy to use script that will allow for me to work with the image, and forget about the code.
This script uses the SimpleImage class to resize images, it has many useful functions that make this image gallery script just work.
PHP Photo Gallery Script Features
Resize images automatically using php
Resize thumbnails, and crop if needed
Cache images for faster access
Each load checks if images still exist or have been changed, then resizes only that one image.
Customized HTML fragment outputted for each image.
Create a custom thumbnail image if needed for any individual image.
Ability to handle multiple image galleries within the same page.
Set Alt tags for each image, and alt tags can be customized.
If sizing images takes too long, the script will auto refresh to complete the resizing of all images
Transparent GIF and PNG files keep the transparency when resized.
Displays loading graphic while images are being generated; graphic is removed from the page once the image gallery shows.
$gallery = new gallery();
$gallery->dir = 'images/gallery1'; // Relative path to the images folder
$gallery->lg_width = 1200;
$gallery->lg_height = 800;
$gallery->sm_width = 160;
$gallery->sm_height = 160;
$gallery->crop = true; // Crop thumbnails; crop=true will make them the exact size, crop=false will resize them no larger than the height and width.
$gallery->html = ''; // Custom html fragment
$gallery->alt = array(
'vivid_flowers-wide.jpg' => 'New alt tag text' // specify alt text for any of the images here by using the image file name
$gallery->alt_default = 'Gallery'; // default alt tag for the gallery