How to get blog_id of an MU site when running a custom function on the parent site
You need to use the global $current_blog instead. $GLOBALS[‘current_blog’]->blog_id will return the correct id.
You need to use the global $current_blog instead. $GLOBALS[‘current_blog’]->blog_id will return the correct id.
Just delete your timthumb.php file. If your site thumbnails use timthumb then the code might look like this <img src=”https://wordpress.stackexchange.com/questions/80287/<?php bloginfo(“template_directory’); ?>/xxxxx/timthumb.php?src=<?php echo “original image url” ?>&h=150&w=150&zc=1″ /> Just replace those instances with code like this the_post_thumbnail(‘thumbnail’, array(‘class’ => ‘thubnail’));
WordPress and TimThumb both use GD to resize images, so quality is going to be similar. GD’s resize quality is not as good as Photoshop, you’ll notice this especially in fine details. Both WP and TimThumb can be modified to use ImageMagick, WP via a plugin, TimThumb I think requires you edit the code directly, … Read more
Take a look here: http://ma.tt/2011/08/the-timthumb-saga/ I assume you know who Matt is. Also, Matt mentioned this guy in that link, and he’s got some updates on the issue posted to his site http://markmaunder.com/2011/08/01/zero-day-vulnerability-in-many-wordpress-themes/ The short is, there’s now TimThumb 2.0 which is fixed. It’s available here http://code.google.com/p/timthumb/
Instead of using timthumb, use the internal image API. Firstly, specify the custom size you’re wanting to use by using add_image_size: Usage: <?php add_image_size( $name, $width, $height, $crop ); ?> So you would put this in your themes functions.php: add_image_size( ‘large_post_image_header’, 660,246,true); Then, instead of: <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘full’ ); ?> … Read more
I always do this with Timthumb: // this is the absolute path $url=”http://crizaze.com/wp-content/themes/joorang/wp-content/uploads/2011/01/ami166a-e1295733091216.jpg”; // convert it into relative path $url = str_replace(get_bloginfo(‘url’), ”, $url); // get the image url, resized by timthumb $timthumb_url = get_stylesheet_directory_uri() . “/timthumb.php?src=$url&w=80&h=80”;
TimThumb has never been bundled with WordPress, it is/was entirely a third-party theme/plugin issue.
Cadeyrn’s code work probably for 1 specific size ( 200&w=350& etc) , the major problem with timthumb and the reason people use it, is that it allows for many dynamic sizes thus making .htaccess rewrite rules much more difficult, especially if you using friendly WordPress permalink structure. There is a guide here on how to … Read more
There are two reasons: post_thumbnail was introduced with WordPress 2.9, and many themes which used TimThumb because post_thumbnail wasn’t yet available to them. TimThumb is more flexible than post_thumbnail — it gives you more options for how images are cropped, and allows for simple filters to be applied to the images. However, TimThumb has also caused … Read more
I’m not quite sure you’re using the wp_check_filetype() correctly. I just successfully tried the following to determine if the post thumbnail ext was jpg or not: $url = wp_get_attachment_url( get_post_thumbnail_id( ) ); $filetype = wp_check_filetype($url); if ($filetype[ext] == ‘jpg’) { echo ‘this is gif’; } else { echo ‘this aint gif’; } You probably know … Read more