سؤال

I always though the the image manager into wp is not really good... I need to be able to generate square or custom size when i like where i like, much like TimThumb that generate thum on the fly... but a little complicated...

what do you use or what is the best plugin...

هل كانت مفيدة؟

المحلول 3

I have find this faboulous article... just copy/paste it here for future reference : http://webdeveloperplus.com/wordpress/how-to-use-thumbnails-generated-by-wordpress-in-your-theme/

نصائح أخرى

I made my own, but I only included the basic parameters. Just place this code in your theme's functions.php file. You will need to update the path to timThumb.

// [timThumb id="123" w="300"]
function timThumb_func( $atts ) {
    extract( shortcode_atts( array(
        'id' => '',
        'w' => '',
        'h' => '',
        'q' => '90'
    ), $atts ) );

    $timThumbPath = 'Path/to/timThumb.php';
    $image = wp_get_attachment_image_src( $id );

    if(!$image) {
        return
    } else {
        return '<img src="'.$timThumbPath.'?src='.$image[0].'&w='.$w.'&h='.$h.'&q='.$q.'" />';
    }
}
add_shortcode( 'timThumb', 'timThumb_func' );
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى wordpress.stackexchange
scroll top