2

We want to use wordpress to host image which we'll use in our email newsletter.

To that end, we can obviously upload the image via the Media panel in Admin and either right-click the image and get URL or enter Library and click the image to see the URL in the details area.

Then we could manually add the thumbnail size based on theme/settings:

a_full_url/image.150x150.ext

And of course we could add the Medium or Large image into a Post or Page and right-click).

Is there an easier way, via the GUI that an administrator can view/get the various sizes for an image?

3

This is a good idea. Thanks for suggesting it—going to use it. :)

You can add a column to the Media Library that outputs the paths. This will spit them all out. You could of course filter it to only show the sizes you actually want. Put in functions.php or similar.

// Adds a "Sizes" column
function sizes_column( $cols ) {
        $cols["sizes"] = "Sizes";
        return $cols;
}

// Fill the Sizes column
function sizes_value( $column_name, $id ) {
    if ( $column_name == "sizes" ) {
        // Including the direcory makes the list much longer 
        // but required if you use /year/month for uploads
        $up_load_dir =  wp_upload_dir();
        $dir = $up_load_dir['url'];

        // Get the info for each media item
        $meta = wp_get_attachment_metadata($id);

        // and loop + output
        foreach ( $meta['sizes'] as $name=>$info) {
            // could limit which sizes are output here with a simple if $name ==
            echo "<strong>" . $name . "</strong><br>";
            echo "<small>" . $dir . "/" . $info['file'] . " </small><br>";
        }
    }
}

// Hook actions to admin_init
function hook_new_media_columns() {
    add_filter( 'manage_media_columns', 'sizes_column' );
    add_action( 'manage_media_custom_column', 'sizes_value', 10, 2 );
}
add_action( 'admin_init', 'hook_new_media_columns' )

Using <small> as a quick and dirty hack to keep the size of long URLs in check. In production I'd probably make this a <dl> and add some admin CSS to adjust its display via site plugin.

enter image description here

  • really cool. I think it works better for this use than using the Display All Image Sizes plugin linked in the other answer. – MikeiLL Aug 31 '15 at 0:20
1

The fact that basic WP functionality wont provide you a panel to manage those sizes and retrieve media links.

You can continue using a a_full_url/image.150x150.ext, or:

1) Go-to any post/page entity via admin panel. Use 'Add image' function

2) Select a specific size that you need and apply image

Wordpress Attachment Details

3) Goto "Text" editor mode of the same post and find <img scr="YOUR_IMAGE_URL_OF_SPECIFIC_SIZE" />. Copy that and leave editor after cancelling changes.

Complicated and not user-friendly solution, but this is what you can achieve using UI-only, without 3rd party plugins.

  • Yes. That was basically my understanding. I think I wasn't quite clear in my question, though. I don't mind using a plugin. Is there one you can recommend? – MikeiLL Aug 30 '15 at 18:55
  • It's actually a_full_url/image-150x150.ext and not a_full_url/image.150x150.ext Not a fullstop but a dash – Uriahs Victor Mar 16 '18 at 18:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.