PluginProbe
Image Optimizer – Compress Images and Convert to WebP or AVIF / 1.7.7
Image Optimizer – Compress Images and Convert to WebP or AVIF v1.7.7
1.7.7 1.7.6 1.7.5 1.7.4 trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.2.0 1.2.1 1.3.0 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 All 33 releases
← All changes | classes/image/image.php +12 -2 1.5.01.7.7 View file →
@@ -70,8 +70,18 @@
70 70 $path_data['path']
71 71 );
72 72 }
73 73
74 + public function file_exists( string $image_size ): bool {
75 + $path = $this->get_file_path( $image_size );
76 +
77 + if ( ! $path ) {
78 + return false;
79 + }
80 +
81 + return file_exists( $path );
82 + }
83 +
74 84 /**
75 85 * Returns true if an image marked as optimized.
76 86 *
77 87 * @return bool
@@ -177,12 +187,12 @@
177 187 $this->image_id = $image_id;
178 188 $this->attachment_object = get_post( $image_id );
179 189
180 190 if ( ! $this->attachment_object ) {
181 - throw new Invalid_Image_Exception( "There is no entity with id '$image_id'" );
191 + throw new Invalid_Image_Exception( esc_html( "There is no entity with id '$image_id'" ) );
182 192 }
183 193
184 194 if ( ! wp_attachment_is_image( $this->attachment_object ) ) {
185 - throw new Invalid_Image_Exception( "Post '$image_id' is not an image" );
195 + throw new Invalid_Image_Exception( esc_html( "Post '$image_id' is not an image" ) );
186 196 }
187 197 }
188 198 }