Ajay, please incorporate this patch into the next version of Top 10 🙂
I’ve been very happy with Top 10 since I patched it to support Video Thumbnails and to make it respect the setting for max width and max height. Top 10 1.7.6 doesn’t recognize thumbnails generated by Video Thumbnails and it stretches the images so that they are shown at the specified max width and height. For example with max width 100 and max height 100 a thumbnail of 480 x 360 is stretched to 100 x 100 violating the image dimensions, when it should be shown as 100 x 75 respecting the image dimensions.
Please jump to the second post from here, that patch incorporates the one included here and adds an option for displaying no image instead of the default when no thumb is found, improves performance and cleans the code slightly.
Only in case you don’t agree with the second post, here’s the original one:
Here’s how: in top10.php, find lines 180 and 181:
if (!$postimage) $postimage = $tptn_settings[thumb_default]; $output .= '<img src="'.$postimage.'" alt="'.$title.'" title="'.$title.'" width="'.$tptn_settings[thumb_width].'" height="'.$tptn_settings[thumb_height].'" border="0" class="tptn_thumb" />';
and replace them with
if (!$postimage) $postimage = get_post_meta($result->postnumber, '_video_thumbnail', true); // If no other thumbnail set, try to get the custom video thumbnail set by the Video Thumbnails plugin if (!$postimage) $postimage = $tptn_settings[thumb_default]; // If no thumb found, use default $output .= '<img src="'.$postimage.'" alt="'.$title.'" title="'.$title.'" style="max-width:'.$tptn_settings[thumb_width].'px;max-height:'.$tptn_settings[thumb_height].'px;" border="0" class="tptn_thumb" />';
After this it’s good to also update the comments. Previously from line 317, after the above from 317, find:
'thumb_height' => '100', // Height of thumbnails 'thumb_width' => '100', // Width of thumbnails
and replace it with
'thumb_height' => '100', // Max height of thumbnails 'thumb_width' => '100', // Max width of thumbnails
This patch may need similar changes in some of the .js.php files. At least top-10-daily.js.php replicates the thumbnail function in a way that also requires replicating the first of the above patches.
- The topic ‘[Plugin: Top 10] Patch: Fix max width & height, support for Video Thumbnails, option: no thumb’ is closed to new replies.