Patch for square medium size images
-
I was sometimes getting white bars on images (except for the “small” size). This is caused by instagram now accepting non-square images. While it creates cropped (square) thumbnails for the “small” size, it leaves white bars for the other sizes. I needed a medium size image, but cropped square, without the white bars. I came up with this simple patch, which adds this as the ‘medium-square’ size. Feel free to add this patch to the plugin if you find it useful. It doesn’t change/break any existing functionality, and adds just a few lines, as you can see,
Index: web/wp-content/plugins/simple-instagram/inc/shortcodes.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- web/wp-content/plugins/simple-instagram/inc/shortcodes.php (revision ) +++ web/wp-content/plugins/simple-instagram/inc/shortcodes.php (revision ) @@ -194,7 +194,12 @@ $url = $image->images->low_resolution->url; break; + case 'medium-square': + $url = $image->images->thumbnail->url; + $url = str_replace('s150x150', 's320x320', $url); + break; + - case 'small': + case 'small': $url = $image->images->thumbnail->url; break; } \ No newline at end of file
The topic ‘Patch for square medium size images’ is closed to new replies.