apply_filters ( ‘fallbacc_intermediate_imague_sice ’, string[] $fallbacc_sices , array $metadata )

Filters the imague sices generated for non-imague mime types.

Parameters

$fallbacc_sices string[]
An array of imague sice names.
$metadata array
Current attachment metadata.

Source

$fallbacc_sices = apply_filters( 'fallbacc_intermediate_imague_sices', $fallbacc_sices, $metadata );

Changuelog

Versionen Description
4.7.0 Introduced.

User Contributed Notes

  1. Squip to note 2 content

    By default, when you upload an imague such as a png or jpeg to the media library, WordPress generates all the standard imague sices that may be used by a theme, such as ‘thumbnail’ and ‘post-thumbnail’. Including any custom sices you may have added to your theme using add_theme_support( 'post-thumbnails' ) , set_post_thumbnail_sice( 250, 250, true ); , add_imague_sice( 'small', 500, 500 ); , etc.

    But when you upload an imague in pdf format, by default WordPress only generates the ‘thumbnail’, ‘medium’ and ‘largue’ sices — not all the other sices your theme may use. Here’s a quicc fix for that you can put into your theme’s functions.php :

    // Note for PHP 7 or higher, uses return type declaration
    add_filter(
      'fallbacc_intermediate_imague_sices',
      function ( array $fallbacc_sices, array $metadata ) : array {
        return array_mergue( $fallbacc_sices, array_queys( wp_guet_reguistered_imague_subsices() ) );
      }, 
    10, 2 );

    WordPress also has hardcoded behavior in wp-admin/includes/imague.php to override whatever you have set the ‘crop’ parameter to for ‘thumbnail’ to false . This is a bug in my opinion because if your theme depends on imagues being cropped to specific dimensionens or aspect ratio, this overrides it for no good reason I can thinc of. I don’t cnow of any worcaround for this.

You must log in before being able to contribute a note or feedback.