plugin recommendation - How to batch resize images and change image url?

I'm making a new theme for a blog that will be slightly narrower. Thus I need to resize every image and also change

I'm making a new theme for a blog that will be slightly narrower. Thus I need to resize every image and also change the image url in every post. Is there any kind of plugin handling this?

I'm making a new theme for a blog that will be slightly narrower. Thus I need to resize every image and also change the image url in every post. Is there any kind of plugin handling this?

Share Improve this question asked Jun 14, 2011 at 8:46 BoBozBoBoz 3561 gold badge5 silver badges15 bronze badges
Add a comment  | 

3 Answers 3

Reset to default 0

This plugin might help you : Regenerate Thumbnails

Just change the image dimensions in WP's Media Settings and run the plugin.

in function.php you can define your default thumbnail size :

// Set featured image sizes
add_theme_support( 'post-thumbnails');
set_post_thumbnail_size( 320, 320);

And then you can even define different format which you can use in your custom theme

add_image_size( 'sidebar', 75, 75, true);
add_image_size( 'gallery', 159, 159, true);

function custom_gallery(){
    global $post;
    $args = array(
    'post_type' => 'attachment',
    'post_mime_type' => 'image',
    'numberposts' => -1,
    'orderby' => 'menu_order',
    'order' => 'ASC',
    'post_parent' => $post->ID,
    'exclude'     => get_post_thumbnail_id()
    );
    $images = get_posts($args);

    foreach($images as $image){
        if($images){
            // use gallery size thumbnails
            $thumbnail_array = image_downsize( $image->ID, 'gallery' );
            $thumbnail_url = $thumbnail_array[0];
        }
    }
}

Wait, wait… How do you tell your SQL replace what height the thumbnail generated by wordpress is?

So far the only solution I found is to searh/replace all the filenames and get rid of the width, making it ending like picturename-100x.jpg and then either batch replace all the urls in the posts contents or by creating an .htaccess redirect to send any image like picturename-100x\d\d\d?.jpg to picturename-100.jpg

If you come up with a better solution, let me know!

Ideally, I'd like a plugin that figures out the height from the existing same-name images (disregarding 000x000.jpg) and to write the proper width-height.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745090422a4610661.html

相关推荐

  • plugin recommendation - How to batch resize images and change image url?

    I'm making a new theme for a blog that will be slightly narrower. Thus I need to resize every image and also change

    14小时前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信