WordPress.org

Ready to get started?Download WordPress

Forums

Need more image sizes for your blog? Here's a plugin (9 posts)

  1. waltervos
    Member
    Posted 4 years ago #

    I just released my new plugin, called 'Additional image sizes'. You can download it from here. I'd like to get some feedback to see how I can improve it.

    With this plugin, users can add and remove intermediate image sizes. The plugin can also make copies of existing images with these new sizes. Users will be able to use the images in their posts or use them in their theme with the use of the 'Get the image' plugin (this is the use case I had in mind mostly).

  2. catnip216
    Member
    Posted 4 years ago #

    The plugin works great, I can see the new image sizes in my upload folder, but I was just wondering how exactly to call them into your theme with the "Get the Image" plugin.

    Is it something like this?
    <?php if ( function_exists( 'get_the_image' ) ) { get_the_image( 'default_size=my_new_image_size' ); } ?>

    Thanks in advance.
    -Amanda

  3. waltervos
    Member
    Posted 4 years ago #

    @catnip216 I'm glad to hear that it works for you. This is the code that I have in my theme:

    <?php if (function_exists('get_the_image')) { echo get_the_image('default_size=blogindex&width=220&height=140'); } ?>

    Where blogindex is the name of the size. I'm not sure why I have the width and height parameters as well.

    Hope this helps!

    Edit: Those width and height parameters are used as attributes for the <img> element. They're not necessary

  4. Steffen Jørgensen
    Member
    Posted 4 years ago #

    Is there any way to run this function on ALL images uploaded in one go?

    I keep getting this message:

    Not quite finished yet. We had to stop the script midway because it had been running for too long. Just press the button again to continue where we left off.

    And only a few (3-10) images has been resized, sometimes (more like most of times) none has been resized...

    I have about 200 posts in my photoblog, and having to do this for only a few images at a time takes forever...

  5. waltervos
    Member
    Posted 4 years ago #

    Is there any way to run this function on ALL images uploaded in one go?

    On line 387 of the plugin file, replace break; with //break;. That should do the trick.

    I'll see what I can do to improve this function in the next update.

    - Walter

    Edit: To be sure, look for this piece of code:

    if ($max_execution_time - $current_execution_time < 2) {
        break;
    }
  6. striker
    Member
    Posted 4 years ago #

    Any chance have any guesses why this won't work in wordpress mu? It installs fine, and I can add sizes just fine, and they show up in the add image screen, but when I go to upload, none of the images are uploaded other than thumbnail and full size, and it's not added to the gallery.

  7. waltervos
    Member
    Posted 4 years ago #

    Any chance have any guesses why this won't work in wordpress mu?

    I really don't know anything about WP MU, sorry! I don't really have the time to look into it right now. Maybe 3.0 will fix this? Because of the merge I mean.

  8. Dartanjan
    Member
    Posted 4 years ago #

    Is there a way this could work without 'Get the image' plugin? Ideally, to make it work with wp_get_attachment_image_src( $id, $size ) or at least provide your own function, like get_additional_image( $image, $size )

    Edit: nevermind, I'll be using it with the 'Get the image' plugin.

  9. waltervos
    Member
    Posted 4 years ago #

    Hi Dartanjan,

    There's no need to use the Get the image plugin. You can use your own function for retrieving images, use a different plugin or use WP 2.9's built in thumbnail functions. Providing a function for that is beyond the scope of this plugin though.

    Walter

Topic Closed

This topic has been closed to new replies.

About this Topic