TimThumb issue, Sitewide Tags, update_option, and add_image_size function
-
Mostly everyone’s heard of the TimThumb issue, which sounds like is solved, but it got me to thinking about how to avoid using TT if possible.
I’m using Twentyeleven as the base for my child theme. I’m using one child for my main blog and another for the sub blogs, so both are enabled for thumbnails. Also, the network settings allow for image uploads.
I also have a custom post type that I created on the main page, and I’m using thumbnail images from those posts in a slider above the content I’m describing here.
What I want to do is display thumbnails alongside the stream created by SiteWide Tags plugin.
I did some research and found that you can change the media thumbnail settings through (this code may not be perfect):
update_option ('thumbnail_size_w', 150, true); update_option ('thumbnail_size_h', 150, true);
which would change the default size for the small thumbs to 150px and crop them as well.
You can also create and name a custom size (which is gets to what my question is) using:
add_image_size ( 'my_custom_size', 60, 60, true);
which can then be presented in the loop for example with
the_post_thumbnail ('my_custom_size');
I’ve played with this, but I’m a bit confused. When using Sitewide Tags, in the loop created on my network home page, seems there’s a lot going on to consider. There’s the local default thumb size setting in the admin settings my sub sites are using, the default thumb size on the theme my main site is using, and the custom settings I created that will be in the functions.php file for either my sub blogs, main blog or both I’m not sure where to put them).
Seems very simple at first, then get’s more complicated as I try to implement it. I want the simplest solution possible.
At first this seemed to best work by modifying the sub sites’ function.php files to create a custom size, and do the same (using the same custom size name) on my main blog’s function.php file, but when I try to call the image, it does not change. Each of the images is different size, reflecting some of the testing I did, but I was assuming setting a custom size and calling for that would have resulted in the same size thumbnails from each of the posts.
By the way, I also used the regenerate thumbnail plugin before I refreshed the page.
After all this, I’m wondering, “Is it better to just use TimThumb?”
I hope this all makes sense, and thanks for any input.
- The topic ‘TimThumb issue, Sitewide Tags, update_option, and add_image_size function’ is closed to new replies.