default
7 months ago
dummy
7 months ago
shortpixel
7 months ago
.DS_Store
7 months ago
class-foogallery-thumb-engine.php
7 months ago
class-foogallery-thumb-image-editor-gd.php
7 months ago
class-foogallery-thumb-image-editor-imagick.php
7 months ago
class-foogallery-thumb-manager.php
7 months ago
includes.php
7 months ago
class-foogallery-thumb-engine.php
62 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Base class for the thumbnail engine |
| 4 | */ |
| 5 | if ( ! class_exists( 'FooGallery_Thumb_Engine' ) ) { |
| 6 | |
| 7 | abstract class FooGallery_Thumb_Engine { |
| 8 | |
| 9 | /** |
| 10 | * Does any initilization needed for the engine |
| 11 | */ |
| 12 | abstract function init(); |
| 13 | |
| 14 | /** |
| 15 | * Generates a thumbnail for an image based on arguments |
| 16 | * |
| 17 | * @param $url |
| 18 | * @param array $args |
| 19 | * |
| 20 | * @return string |
| 21 | */ |
| 22 | abstract function generate( $url, $args = array() ); |
| 23 | |
| 24 | /** |
| 25 | * Does the engine use a local cache to store thumbnails |
| 26 | * @return bool |
| 27 | */ |
| 28 | abstract function has_local_cache(); |
| 29 | |
| 30 | /** |
| 31 | * Clears the local cach for a file |
| 32 | * @param $file |
| 33 | */ |
| 34 | abstract function clear_local_cache_for_file( $file ); |
| 35 | |
| 36 | /** |
| 37 | * Returns the last error encountered when trying to generate a thumbnail |
| 38 | * @return mixed |
| 39 | */ |
| 40 | abstract function get_last_error(); |
| 41 | |
| 42 | /** |
| 43 | * Returns true if the engine utilizes WordPress Image Editors under the hood |
| 44 | * By default, if the engine has a local cache, then they would also use image editors |
| 45 | * |
| 46 | * @return bool |
| 47 | */ |
| 48 | function uses_image_editors() { |
| 49 | return $this->has_local_cache(); |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Returns true if the engine requires thumb generation tests to be performed |
| 54 | * By default, if the engine has a local cache, then they would also use require tests |
| 55 | * |
| 56 | * @return bool |
| 57 | */ |
| 58 | function requires_thumbnail_generation_tests() { |
| 59 | return $this->has_local_cache(); |
| 60 | } |
| 61 | } |
| 62 | } |