Skip to content

Commit 9e96dfe

Browse files
committed
Rely on srcset to select best image size; only add Story Page as available image size
1 parent 48caf6b commit 9e96dfe

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

includes/class-amp-story-media.php

+3-10
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,7 @@ public static function ensure_correct_poster_size( $image, $attachment_id, $size
205205
/**
206206
* Adds a new max image size to the image sizes available.
207207
*
208-
* In the AMP story editor, when selecting Background Media,
209-
* it will use this custom image size.
210-
* This filter will also make it available in the Image block's 'Image Size' <select> element.
208+
* This filter makes this custom image size available in the Image block's 'Image Size' <select> element.
211209
*
212210
* @param array $image_sizes {
213211
* An associative array of image sizes.
@@ -218,15 +216,10 @@ public static function ensure_correct_poster_size( $image, $attachment_id, $size
218216
* @return array $image_sizes The filtered image sizes.
219217
*/
220218
public static function add_new_max_image_size( $image_sizes ) {
221-
$full_size_name = __( 'Story Max Size', 'amp' );
222219

223-
if ( isset( $_POST['action'] ) && ( 'query-attachments' === $_POST['action'] || 'upload-attachment' === $_POST['action'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
224-
$image_sizes[ self::MAX_IMAGE_SIZE_SLUG ] = $full_size_name;
225-
} elseif ( get_post_type() && AMP_Story_Post_Type::POST_TYPE_SLUG === get_post_type() ) {
226-
$image_sizes[ self::MAX_IMAGE_SIZE_SLUG ] = $full_size_name;
227-
unset( $image_sizes['full'] );
220+
if ( AMP_Story_Post_Type::POST_TYPE_SLUG === get_post_type() ) {
221+
$image_sizes[ self::MAX_IMAGE_SIZE_SLUG ] = __( 'Story Page', 'amp' );
228222
}
229-
230223
return $image_sizes;
231224
}
232225

0 commit comments

Comments
 (0)