| @@ -1,32 +1,39 @@ | ||
| 1 | 1 | <?php |
| 2 | +declare(strict_types=1); | |
| 3 | + | |
| 2 | 4 | namespace Imagify\Optimization\Process; |
| 3 | 5 | |
| 4 | -defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' ); | |
| 6 | +use Imagify\Optimization\Data\DataInterface; | |
| 7 | +use Imagify\Media\MediaInterface; | |
| 8 | +use Imagify\Optimization\File; | |
| 9 | +use WP_Error; | |
| 5 | 10 | |
| 6 | 11 | /** |
| 7 | 12 | * Fallback class to optimize medias. |
| 8 | - * | |
| 9 | - * @since 1.9 | |
| 10 | - * @author Grégory Viguier | |
| 11 | 13 | */ |
| 12 | 14 | class Noop implements ProcessInterface { |
| 15 | + /** | |
| 16 | + * The suffix used in the thumbnail size name. | |
| 17 | + * | |
| 18 | + * @var string | |
| 19 | + * @since 1.9 | |
| 20 | + */ | |
| 21 | + const WEBP_SUFFIX = '@imagify-webp'; | |
| 13 | 22 | |
| 14 | 23 | /** |
| 15 | 24 | * The suffix used in the thumbnail size name. |
| 16 | 25 | * |
| 17 | - * @var string | |
| 18 | - * @since 1.9 | |
| 19 | - * @author Grégory Viguier | |
| 26 | + * @var string | |
| 27 | + * @since 2.2 | |
| 20 | 28 | */ |
| 21 | - const WEBP_SUFFIX = '@imagify-webp'; | |
| 29 | + const AVIF_SUFFIX = '@imagify-avif'; | |
| 22 | 30 | |
| 23 | 31 | /** |
| 24 | 32 | * The suffix used in file name to create a temporary copy of the full size. |
| 25 | 33 | * |
| 26 | - * @var string | |
| 27 | - * @since 1.9 | |
| 28 | - * @author Grégory Viguier | |
| 34 | + * @var string | |
| 35 | + * @since 1.9 | |
| 29 | 36 | */ |
| 30 | 37 | const TMP_SUFFIX = '@imagify-tmp'; |
| 31 | 38 | |
| 32 | 39 | /** |
| @@ -32,11 +39,10 @@ | ||
| 32 | 39 | /** |
| 33 | 40 | * Used for the name of the transient telling if a media is locked. |
| 34 | 41 | * %1$s is the context, %2$s is the media ID. |
| 35 | 42 | * |
| 36 | - * @var string | |
| 37 | - * @since 1.9 | |
| 38 | - * @author Grégory Viguier | |
| 43 | + * @var string | |
| 44 | + * @since 1.9 | |
| 39 | 45 | */ |
| 40 | 46 | const LOCK_NAME = 'imagify_%1$s_%2$s_process_locked'; |
| 41 | 47 | |
| 42 | 48 | /** |
| @@ -42,13 +48,12 @@ | ||
| 42 | 48 | /** |
| 43 | 49 | * Tell if the given entry can be accepted in the constructor. |
| 44 | 50 | * For example it can include `is_numeric( $id )` if the constructor accepts integers. |
| 45 | 51 | * |
| 46 | - * @since 1.9 | |
| 47 | - * @access public | |
| 48 | - * @author Grégory Viguier | |
| 52 | + * @since 1.9 | |
| 49 | 53 | * |
| 50 | - * @param mixed $id Whatever. | |
| 54 | + * @param mixed $id Whatever. | |
| 55 | + * | |
| 51 | 56 | * @return bool |
| 52 | 57 | */ |
| 53 | 58 | public static function constructor_accepts( $id ) { |
| 54 | 59 | return false; |
| @@ -56,11 +61,9 @@ | ||
| 56 | 61 | |
| 57 | 62 | /** |
| 58 | 63 | * Get the data instance. |
| 59 | 64 | * |
| 60 | - * @since 1.9 | |
| 61 | - * @access public | |
| 62 | - * @author Grégory Viguier | |
| 65 | + * @since 1.9 | |
| 63 | 66 | * |
| 64 | 67 | * @return DataInterface|false |
| 65 | 68 | */ |
| 66 | 69 | public function get_data() { |
| @@ -69,11 +72,9 @@ | ||
| 69 | 72 | |
| 70 | 73 | /** |
| 71 | 74 | * Get the media instance. |
| 72 | 75 | * |
| 73 | - * @since 1.9 | |
| 74 | - * @access public | |
| 75 | - * @author Grégory Viguier | |
| 76 | + * @since 1.9 | |
| 76 | 77 | * |
| 77 | 78 | * @return MediaInterface|false |
| 78 | 79 | */ |
| 79 | 80 | public function get_media() { |
| @@ -80,13 +81,33 @@ | ||
| 80 | 81 | return false; |
| 81 | 82 | } |
| 82 | 83 | |
| 83 | 84 | /** |
| 85 | + * Get the File instance of the original file. | |
| 86 | + * | |
| 87 | + * @since 1.9.8 | |
| 88 | + * | |
| 89 | + * @return File|false | |
| 90 | + */ | |
| 91 | + public function get_original_file() { | |
| 92 | + return false; | |
| 93 | + } | |
| 94 | + | |
| 95 | + /** | |
| 96 | + * Get the File instance of the full size file. | |
| 97 | + * | |
| 98 | + * @since 1.9.8 | |
| 99 | + * | |
| 100 | + * @return File|false | |
| 101 | + */ | |
| 102 | + public function get_fullsize_file() { | |
| 103 | + return false; | |
| 104 | + } | |
| 105 | + | |
| 106 | + /** | |
| 84 | 107 | * Get the File instance. |
| 85 | 108 | * |
| 86 | - * @since 1.9 | |
| 87 | - * @access public | |
| 88 | - * @author Grégory Viguier | |
| 109 | + * @since 1.9 | |
| 89 | 110 | * |
| 90 | 111 | * @return File|false |
| 91 | 112 | */ |
| 92 | 113 | public function get_file() { |
| @@ -95,11 +116,9 @@ | ||
| 95 | 116 | |
| 96 | 117 | /** |
| 97 | 118 | * Tell if the current media is valid. |
| 98 | 119 | * |
| 99 | - * @since 1.9 | |
| 100 | - * @access public | |
| 101 | - * @author Grégory Viguier | |
| 120 | + * @since 1.9 | |
| 102 | 121 | * |
| 103 | 122 | * @return bool |
| 104 | 123 | */ |
| 105 | 124 | public function is_valid() { |
| @@ -108,13 +127,12 @@ | ||
| 108 | 127 | |
| 109 | 128 | /** |
| 110 | 129 | * Tell if the current user is allowed to operate Imagify in this context. |
| 111 | 130 | * |
| 112 | - * @since 1.9 | |
| 113 | - * @access public | |
| 114 | - * @author Grégory Viguier | |
| 131 | + * @since 1.9 | |
| 115 | 132 | * |
| 116 | - * @param string $describer Capacity describer. See \Imagify\Context\ContextInterface->get_capacity() for possible values. Can also be a "real" user capacity. | |
| 133 | + * @param string $describer Capacity describer. See \Imagify\Context\ContextInterface->get_capacity() for possible values. Can also be a "real" user capacity. | |
| 134 | + * | |
| 117 | 135 | * @return bool |
| 118 | 136 | */ |
| 119 | 137 | public function current_user_can( $describer ) { |
| 120 | 138 | return false; |
| @@ -119,97 +137,85 @@ | ||
| 119 | 137 | public function current_user_can( $describer ) { |
| 120 | 138 | return false; |
| 121 | 139 | } |
| 122 | 140 | |
| 123 | - | |
| 124 | - /** ----------------------------------------------------------------------------------------- */ | |
| 125 | - /** OPTIMIZATION ============================================================================ */ | |
| 126 | - /** ----------------------------------------------------------------------------------------- */ | |
| 127 | - | |
| 128 | 141 | /** |
| 129 | 142 | * Optimize a media files by pushing tasks into the queue. |
| 130 | 143 | * |
| 131 | - * @since 1.9 | |
| 132 | - * @access public | |
| 133 | - * @author Grégory Viguier | |
| 144 | + * @since 1.9 | |
| 145 | + * @since 2.3.2 Added the $args parameter. | |
| 134 | 146 | * |
| 135 | - * @param int $optimization_level The optimization level (0=normal, 1=aggressive, 2=ultra). | |
| 136 | - * @return bool|WP_Error True if successfully launched. A \WP_Error instance on failure. | |
| 147 | + * @param int $optimization_level The optimization level (0=normal, 1=aggressive, 2=ultra). | |
| 148 | + * @param array $args An array of optionnal arguments. | |
| 149 | + * | |
| 150 | + * @return bool|WP_Error True if successfully launched. A WP_Error instance on failure. | |
| 137 | 151 | */ |
| 138 | - public function optimize( $optimization_level = null ) { | |
| 139 | - return new \WP_Error( 'invalid_media', __( 'This media is not valid.', 'imagify' ) ); | |
| 152 | + public function optimize( $optimization_level = null, $args = [] ) { | |
| 153 | + return new WP_Error( 'invalid_media', __( 'This media is not valid.', 'imagify' ) ); | |
| 140 | 154 | } |
| 141 | 155 | |
| 142 | 156 | /** |
| 143 | 157 | * Re-optimize a media files with a different level. |
| 144 | 158 | * |
| 145 | - * @since 1.9 | |
| 146 | - * @access public | |
| 147 | - * @author Grégory Viguier | |
| 159 | + * @since 1.9 | |
| 160 | + * @since 2.3.2 Added the $args parameter. | |
| 148 | 161 | * |
| 149 | - * @param int $optimization_level The optimization level (0=normal, 1=aggressive, 2=ultra). | |
| 150 | - * @return bool|WP_Error True if successfully launched. A \WP_Error instance on failure. | |
| 162 | + * @param int $optimization_level The optimization level (0=normal, 1=aggressive, 2=ultra). | |
| 163 | + * @param array $args An array of optionnal arguments. | |
| 164 | + * | |
| 165 | + * @return bool|WP_Error True if successfully launched. A WP_Error instance on failure. | |
| 151 | 166 | */ |
| 152 | - public function reoptimize( $optimization_level = null ) { | |
| 153 | - return new \WP_Error( 'invalid_media', __( 'This media is not valid.', 'imagify' ) ); | |
| 167 | + public function reoptimize( $optimization_level = null, $args = [] ) { | |
| 168 | + return new WP_Error( 'invalid_media', __( 'This media is not valid.', 'imagify' ) ); | |
| 154 | 169 | } |
| 155 | 170 | |
| 156 | 171 | /** |
| 157 | 172 | * Optimize several file sizes by pushing tasks into the queue. |
| 158 | 173 | * |
| 159 | - * @since 1.9 | |
| 160 | - * @access public | |
| 161 | - * @author Grégory Viguier | |
| 174 | + * @since 1.9 | |
| 175 | + * @since 2.3.2 Added the $args parameter. | |
| 162 | 176 | * |
| 163 | - * @param array $sizes An array of media sizes (strings). Use "full" for the size of the main file. | |
| 164 | - * @param int $optimization_level The optimization level (0=normal, 1=aggressive, 2=ultra). | |
| 165 | - * @return bool|WP_Error True if successfully launched. A \WP_Error instance on failure. | |
| 177 | + * @param array $sizes An array of media sizes (strings). Use "full" for the size of the main file. | |
| 178 | + * @param int $optimization_level The optimization level (0=normal, 1=aggressive, 2=ultra). | |
| 179 | + * @param array $args An array of optionnal arguments. | |
| 180 | + * | |
| 181 | + * @return bool|WP_Error True if successfully launched. A WP_Error instance on failure. | |
| 166 | 182 | */ |
| 167 | - public function optimize_sizes( $sizes, $optimization_level = null ) { | |
| 168 | - return new \WP_Error( 'invalid_media', __( 'This media is not valid.', 'imagify' ) ); | |
| 183 | + public function optimize_sizes( $sizes, $optimization_level = null, $args = [] ) { | |
| 184 | + return new WP_Error( 'invalid_media', __( 'This media is not valid.', 'imagify' ) ); | |
| 169 | 185 | } |
| 170 | 186 | |
| 171 | 187 | /** |
| 172 | 188 | * Optimize one file with Imagify directly. |
| 173 | 189 | * |
| 174 | - * @since 1.9 | |
| 175 | - * @access public | |
| 176 | - * @author Grégory Viguier | |
| 190 | + * @since 1.9 | |
| 177 | 191 | * |
| 178 | - * @param string $size The media size. | |
| 179 | - * @param int $optimization_level The optimization level (0=normal, 1=aggressive, 2=ultra). | |
| 180 | - * @return array|WP_Error The optimization data. A \WP_Error instance on failure. | |
| 192 | + * @param string $size The media size. | |
| 193 | + * @param int $optimization_level The optimization level (0=normal, 1=aggressive, 2=ultra). | |
| 194 | + * | |
| 195 | + * @return array|WP_Error The optimization data. A WP_Error instance on failure. | |
| 181 | 196 | */ |
| 182 | 197 | public function optimize_size( $size, $optimization_level = null ) { |
| 183 | - return new \WP_Error( 'invalid_media', __( 'This media is not valid.', 'imagify' ) ); | |
| 198 | + return new WP_Error( 'invalid_media', __( 'This media is not valid.', 'imagify' ) ); | |
| 184 | 199 | } |
| 185 | 200 | |
| 186 | 201 | /** |
| 187 | 202 | * Restore the media files from the backup file. |
| 188 | 203 | * |
| 189 | - * @since 1.9 | |
| 190 | - * @access public | |
| 191 | - * @author Grégory Viguier | |
| 204 | + * @since 1.9 | |
| 192 | 205 | * |
| 193 | - * @return bool|WP_Error True on success. A \WP_Error instance on failure. | |
| 206 | + * @return bool|WP_Error True on success. A WP_Error instance on failure. | |
| 194 | 207 | */ |
| 195 | 208 | public function restore() { |
| 196 | - return new \WP_Error( 'invalid_media', __( 'This media is not valid.', 'imagify' ) ); | |
| 209 | + return new WP_Error( 'invalid_media', __( 'This media is not valid.', 'imagify' ) ); | |
| 197 | 210 | } |
| 198 | 211 | |
| 199 | - | |
| 200 | - /** ----------------------------------------------------------------------------------------- */ | |
| 201 | - /** MISSING THUMBNAILS ====================================================================== */ | |
| 202 | - /** ----------------------------------------------------------------------------------------- */ | |
| 203 | - | |
| 204 | 212 | /** |
| 205 | 213 | * Get the sizes for this media that have not get through optimization. |
| 206 | 214 | * No sizes are returned if the file is not optimized, has no backup, or is not an image. |
| 207 | 215 | * The 'full' size os never returned. |
| 208 | 216 | * |
| 209 | - * @since 1.9 | |
| 210 | - * @access public | |
| 211 | - * @author Grégory Viguier | |
| 217 | + * @since 1.9 | |
| 212 | 218 | * |
| 213 | 219 | * @return array|WP_Error { |
| 214 | 220 | * A WP_Error object on failure. |
| 215 | 221 | * An array of data for the thumbnail sizes on success. |
| @@ -228,47 +234,32 @@ | ||
| 228 | 234 | |
| 229 | 235 | /** |
| 230 | 236 | * Optimize missing thumbnail sizes. |
| 231 | 237 | * |
| 232 | - * @since 1.9 | |
| 233 | - * @access public | |
| 234 | - * @author Grégory Viguier | |
| 238 | + * @since 1.9 | |
| 235 | 239 | * |
| 236 | - * @return bool|WP_Error True if successfully launched. A \WP_Error instance on failure. | |
| 240 | + * @return bool|WP_Error True if successfully launched. A WP_Error instance on failure. | |
| 237 | 241 | */ |
| 238 | 242 | public function optimize_missing_thumbnails() { |
| 239 | - return new \WP_Error( 'invalid_media', __( 'This media is not valid.', 'imagify' ) ); | |
| 243 | + return new WP_Error( 'invalid_media', __( 'This media is not valid.', 'imagify' ) ); | |
| 240 | 244 | } |
| 241 | 245 | |
| 242 | - | |
| 243 | - /** ----------------------------------------------------------------------------------------- */ | |
| 244 | - /** BACKUP FILE ============================================================================= */ | |
| 245 | - /** ----------------------------------------------------------------------------------------- */ | |
| 246 | - | |
| 247 | 246 | /** |
| 248 | 247 | * Delete the backup file. |
| 249 | 248 | * |
| 250 | - * @since 1.9 | |
| 251 | - * @access public | |
| 252 | - * @author Grégory Viguier | |
| 249 | + * @since 1.9 | |
| 253 | 250 | */ |
| 254 | 251 | public function delete_backup() {} |
| 255 | 252 | |
| 256 | - | |
| 257 | - /** ----------------------------------------------------------------------------------------- */ | |
| 258 | - /** RESIZE FILE ============================================================================= */ | |
| 259 | - /** ----------------------------------------------------------------------------------------- */ | |
| 260 | - | |
| 261 | 253 | /** |
| 262 | 254 | * Maybe resize an image. |
| 263 | 255 | * |
| 264 | - * @since 1.9 | |
| 265 | - * @access protected | |
| 266 | - * @author Grégory Viguier | |
| 256 | + * @since 1.9 | |
| 267 | 257 | * |
| 268 | - * @param string $size The size name. | |
| 269 | - * @param File $file A File instance. | |
| 270 | - * @return array|WP_Error A \WP_Error instance on failure, an array on success as follow: { | |
| 258 | + * @param string $size The size name. | |
| 259 | + * @param File $file A File instance. | |
| 260 | + * | |
| 261 | + * @return array|WP_Error A WP_Error instance on failure, an array on success as follow: { | |
| 271 | 262 | * @type bool $resized True when the image has been resized. |
| 272 | 263 | * @type bool $backuped True when the image has been backuped. |
| 273 | 264 | * @type int $file_size The file size in bytes. |
| 274 | 265 | * } |
| @@ -280,60 +271,69 @@ | ||
| 280 | 271 | 'file_size' => 0, |
| 281 | 272 | ]; |
| 282 | 273 | } |
| 283 | 274 | |
| 284 | - | |
| 285 | - /** ----------------------------------------------------------------------------------------- */ | |
| 286 | - /** WEBP ==================================================================================== */ | |
| 287 | - /** ----------------------------------------------------------------------------------------- */ | |
| 288 | - | |
| 289 | 275 | /** |
| 290 | - * Generate WebP images if they are missing. | |
| 276 | + * Generate Nextgen images if they are missing. | |
| 291 | 277 | * |
| 292 | - * @since 1.9 | |
| 293 | - * @access public | |
| 294 | - * @author Grégory Viguier | |
| 278 | + * @since 1.9 | |
| 295 | 279 | * |
| 296 | - * @return bool|WP_Error True if successfully launched. A \WP_Error instance on failure. | |
| 280 | + * @return bool|WP_Error True if successfully launched. A WP_Error instance on failure. | |
| 297 | 281 | */ |
| 298 | - public function generate_webp_versions() { | |
| 299 | - return new \WP_Error( 'invalid_media', __( 'This media is not valid.', 'imagify' ) ); | |
| 282 | + public function generate_nextgen_versions() { | |
| 283 | + return new WP_Error( 'invalid_media', __( 'This media is not valid.', 'imagify' ) ); | |
| 300 | 284 | } |
| 301 | 285 | |
| 302 | 286 | /** |
| 303 | - * Delete the WebP images. | |
| 287 | + * Delete the next gen format images. | |
| 288 | + * This doesn't delete the related optimization data. | |
| 304 | 289 | * |
| 305 | - * @since 1.9 | |
| 306 | - * @access public | |
| 307 | - * @author Grégory Viguier | |
| 290 | + * @since 2.2 | |
| 291 | + * | |
| 292 | + * @param bool $keep_full Set to true to keep the full size. | |
| 293 | + * @return bool|WP_Error True on success. A WP_Error object on failure. | |
| 308 | 294 | */ |
| 309 | - public function delete_webp_files() {} | |
| 295 | + public function delete_nextgen_files( $keep_full = false ) { | |
| 296 | + return false; | |
| 297 | + } | |
| 310 | 298 | |
| 311 | 299 | /** |
| 312 | - * Tell if a thumbnail size is an "Imagify WebP" size. | |
| 300 | + * Tell if a thumbnail size is an "Imagify Next-Gen" size. | |
| 313 | 301 | * |
| 314 | - * @since 1.9 | |
| 315 | - * @access public | |
| 316 | - * @author Grégory Viguier | |
| 302 | + * @since 2.2 | |
| 317 | 303 | * |
| 318 | 304 | * @param string $size_name The size name. |
| 319 | - * @return string|bool The unsuffixed name of the size if WebP. False if not WebP. | |
| 305 | + * | |
| 306 | + * @return string|bool The unsuffixed name of the size if Next-Gen. False if not a Next-Gen. | |
| 320 | 307 | */ |
| 321 | - public function is_size_webp( $size_name ) { | |
| 308 | + public function is_size_next_gen( $size_name ) { | |
| 322 | 309 | return false; |
| 323 | 310 | } |
| 324 | 311 | |
| 312 | + /** | |
| 313 | + * Tell if the media has all next-gen versions. | |
| 314 | + * | |
| 315 | + * @return bool | |
| 316 | + */ | |
| 317 | + public function is_full_next_gen() { | |
| 318 | + return false; | |
| 319 | + } | |
| 325 | 320 | |
| 326 | - /** ----------------------------------------------------------------------------------------- */ | |
| 327 | - /** PROCESS STATUS ========================================================================== */ | |
| 328 | - /** ----------------------------------------------------------------------------------------- */ | |
| 321 | + /** | |
| 322 | + * Tell if the media has a next-gen format. | |
| 323 | + * | |
| 324 | + * @since 2.2 | |
| 325 | + * | |
| 326 | + * @return bool | |
| 327 | + */ | |
| 328 | + public function has_next_gen() { | |
| 329 | + return false; | |
| 330 | + } | |
| 329 | 331 | |
| 330 | 332 | /** |
| 331 | 333 | * Tell if a process is running for this media. |
| 332 | 334 | * |
| 333 | - * @since 1.9 | |
| 334 | - * @access public | |
| 335 | - * @author Grégory Viguier | |
| 335 | + * @since 1.9 | |
| 336 | 336 | * |
| 337 | 337 | * @return bool |
| 338 | 338 | */ |
| 339 | 339 | public function is_locked() { |
| @@ -342,11 +342,9 @@ | ||
| 342 | 342 | |
| 343 | 343 | /** |
| 344 | 344 | * Set the running status to "running" for a period of time. |
| 345 | 345 | * |
| 346 | - * @since 1.9 | |
| 347 | - * @access public | |
| 348 | - * @author Grégory Viguier | |
| 346 | + * @since 1.9 | |
| 349 | 347 | */ |
| 350 | 348 | public function lock() {} |
| 351 | 349 | |
| 352 | 350 | /** |
| @@ -351,27 +349,19 @@ | ||
| 351 | 349 | |
| 352 | 350 | /** |
| 353 | 351 | * Delete the running status. |
| 354 | 352 | * |
| 355 | - * @since 1.9 | |
| 356 | - * @access public | |
| 357 | - * @author Grégory Viguier | |
| 353 | + * @since 1.9 | |
| 358 | 354 | */ |
| 359 | 355 | public function unlock() {} |
| 360 | 356 | |
| 361 | - | |
| 362 | - /** ----------------------------------------------------------------------------------------- */ | |
| 363 | - /** DATA ==================================================================================== */ | |
| 364 | - /** ----------------------------------------------------------------------------------------- */ | |
| 365 | - | |
| 366 | 357 | /** |
| 367 | 358 | * Tell if a size already has optimization data. |
| 368 | 359 | * |
| 369 | - * @since 1.9 | |
| 370 | - * @access public | |
| 371 | - * @author Grégory Viguier | |
| 360 | + * @since 1.9 | |
| 372 | 361 | * |
| 373 | - * @param string $size The size name. | |
| 362 | + * @param string $size The size name. | |
| 363 | + * | |
| 374 | 364 | * @return bool |
| 375 | 365 | */ |
| 376 | 366 | public function size_has_optimization_data( $size ) { |
| 377 | 367 | return false; |
| @@ -379,15 +369,14 @@ | ||
| 379 | 369 | |
| 380 | 370 | /** |
| 381 | 371 | * Update the optimization data for a size. |
| 382 | 372 | * |
| 383 | - * @since 1.9 | |
| 384 | - * @access public | |
| 385 | - * @author Grégory Viguier | |
| 373 | + * @since 1.9 | |
| 386 | 374 | * |
| 387 | - * @param object $response The API response. | |
| 388 | - * @param string $size The size name. | |
| 389 | - * @param int $level The optimization level (0=normal, 1=aggressive, 2=ultra). | |
| 375 | + * @param object $response The API response. | |
| 376 | + * @param string $size The size name. | |
| 377 | + * @param int $level The optimization level (0=normal, 1=aggressive, 2=ultra). | |
| 378 | + * | |
| 390 | 379 | * @return array { |
| 391 | 380 | * The optimization data. |
| 392 | 381 | * |
| 393 | 382 | * @type string $size The size name. |