Pageimage::getVariations() method

Get all size variations of this image

This is useful after a delete of an image (for example). This method can be used to track down all the child files that also need to be deleted.

Usage

// basic usage
$pageimages = $pageimage->getVariations();

// usage with all arguments
$pageimages = $pageimage->getVariations(array $options = []);

Arguments

NameType(s)Description
options (optional)array

Optional, one or more options in an associative array of the following:

  • info (bool): when true, method returns variation info arrays rather than Pageimage objects (default=false).
  • verbose (bool|int): Return verbose array of info. If false, returns only filenames (default=true). This option does nothing unless the info option is true. Also note that if verbose is false, then all options following this one no longer apply (since it is no longer returning width/height info). When integer 1, returned info array also includes Pageimage variation options in 'pageimage' index of returned arrays (since 3.0.137).
  • width (int): only variations with given width will be returned
  • height (int): only variations with given height will be returned
  • width>= (int): only variations with width greater than or equal to given will be returned
  • height>= (int): only variations with height greater than or equal to given will be returned
  • width<= (int): only variations with width less than or equal to given will be returned
  • height<= (int): only variations with height less than or equal to given will be returned
  • suffix (string): only variations having the given suffix will be returned
  • suffixes (array): only variations having one of the given suffixes will be returned
  • noSuffix (string): exclude variations having this suffix
  • noSuffixes (array): exclude variations having any of these suffixes
  • name (string): only variations containing this text in filename will be returned (case insensitive)
  • noName (string): only variations NOT containing this text in filename will be returned (case insensitive)
  • regexName (string): only variations that match this PCRE regex will be returned

Return value

Pageimages array

Returns Pageimages array of Pageimage instances. Only returns regular array if provided $options['info'] is true.


Pageimage methods and properties

API reference based on ProcessWire core version 3.0.244

Latest news

  • ProcessWire Weekly #560
    In the 560th issue of ProcessWire Weekly we'll check out the latest core updates, cover newly released ProcessWire modules, and more. Read on!
    Weekly.pw / 1 February 2025
  • ProcessWire 3.0.244 new main/master version
    ProcessWire 3.0.244 is our newest main/master/stable version. It's been more than a year in the making and is packed with tons of new features, issue fixes, optimizations and more. This post covers all the details.
    Blog / 18 January 2025
  • Subscribe to weekly ProcessWire news

“We chose ProcessWire because of its excellent architecture, modular extensibility and the internal API. The CMS offers the necessary flexibility and performance for such a complex website like superbude.de. ProcessWire offers options that are only available for larger systems, such as Drupal, and allows a much slimmer development process.” —xport communication GmbH