Detect if image file is a thumbnail

You need to know your site’s current thumbnail dimension settings in order for you to detect if the $url is of thumbnail size.

$thumbnail_width = get_option( 'thumbnail_size_w' );
$thumbnail_height = get_option( 'thumbnail_size_h' );

// The do detection
// Assuming you have the image $url

$pattern = '%' . $thumbnail_width . 'x' . $thumbnail_height . '%';

if ( preg_match( $pattern, $url ) ) {
    // do your stuff here ...
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)