40 Responses

  1. donnacha WordSkill
    donnacha WordSkill January 28, 2011 at 4:54 pm |

    Thanks, that’s incredibly useful for something I’m working on, giving Flickr-style size options hadn’t even occurred to me.

    Reply
  2. Randy
    Randy January 28, 2011 at 7:33 pm |

    (Quote)WordPress is still lacking in some ways when it comes to handling media.
    Oh, do you mean like when they output style tags right into the body so the page doesn’t validate? ha!

    Great information. I am always trying to find better ways to work with WP’s image attachments. I try not to use gallery plugins and would rather output everything on my own, then incorporate that output into a gallery or presentation system of my choosing.

    For example: Recently, I had to split all the image attachments for a post into before and after pics and this little tip could have made it even more slick. Oh well. Next time.

    BTW – Does this also find any add_image_size custom sizes or just the sizes set in the media settings?

    Reply
    1. Randy
      Randy January 29, 2011 at 3:20 pm |

      As soon as I posted I saw the plugin in your sidebar! Thanks!

      Reply
  3. Emil
    Emil January 28, 2011 at 7:53 pm |

    Wow this is amazing, good job as always.

    Cheers,
    Emil

    Reply
  4. Michael Beckwith
    Michael Beckwith January 28, 2011 at 11:01 pm |

    Justin, this is a perfect example of what I could use for some client sites that I’ve worked on that have been utilizing featured images. We have worried a bit about what image gets pulled with the possible range of sizes a client may upload. Using the information you showed above, I could make sure we likely pull the necessary one and not break the website layout.

    Reply
  5. Jamal Mohamed
    Jamal Mohamed January 30, 2011 at 12:14 pm |

    I wonder where you get these crazy ideas, Justin! Awesome as usual.

    Reply
  6. Andre
    Andre January 31, 2011 at 4:49 pm |

    Is there any way to put all formats when we insert an image in the post (in lightbox upload)?

    For example: http://img15.imageshack.us/img15/2844/helpwr.jpg

    Thanks

    Reply
  7. max
    max February 10, 2011 at 1:17 am |

    Hi justin, thanks for great function.., i just want to ask is there any way to make the image link that we click will be open up in image.php page… what i mean something like this :

    Size : 150×150 , 300×300..etc

    From your function, if i click 150×150.., then it goes to myimage-150×150.jpg..
    I just wondering if you could make it appear in image.php if i click 150×150.. not to image location..

    the link maybe like this :
    Original image.php link
    http://www.mysite.com/mytitle/attachment/myimage/

    If click on 150×150 goes to here :
    http://www.mysite.com/mytitle/attachment/myimage-150×150/

    Can it be done..?

    Reply
  8. Navin
    Navin February 15, 2011 at 3:51 am |

    Thanks Justin, I will impleament this in my blog…thanks alot for sharing :)

    Reply
  9. Heather
    Heather February 18, 2011 at 4:49 am |

    Is there any working example? I would love to see it, it can be interesting demonstration to show my designers (if I understand correctly what you describe). We launched a new WP site few weeks ago, but handling pictures (since there have been and will be many listings added) has been always challenge.

    Reply
  10. Kiley
    Kiley February 25, 2011 at 10:17 pm |

    Hey Justin, yeah you were right. I’ve been using it. You can add the link not Flickr links only but anywhere you wanted your images to be redirected once clicked. This gave more ideas to those who were not doing this yet.

    Reply
  11. Linking to all image sizes in WordPress | Mark Wilkinson on WordPress
  12. eddy
    eddy March 2, 2011 at 7:31 pm |

    This is the perfect blog for anyone who wants to know about this topic. You know so much its almost hard to argue with you (not that I really would want…hehe). You definitely put a new spin on a subject that’s been written about for years. Great stuff, just great!

    Reply
  13. Herman
    Herman March 5, 2011 at 9:35 pm |

    I would like to see an example,looks interesting.

    Reply
  14. Ross
    Ross March 6, 2011 at 2:59 am |

    Hi Justin

    Thanks for the info, I’ve been looking for a fix like this! Shall be implementing it this afternoon once I’ve gotten some coffee in me…. always a nervous time when changing CSS. Shall be doing much backing up first! Fingers crossed

    Cheers

    Ross

    Reply
  15. Inviting Your Opinions for Photo Blogging Support » Aquoid Themes
  16. Shehzad
    Shehzad March 10, 2011 at 9:46 am |

    Been trying to do this for a while, thanks for the excellent post, will try it and let you know how it goes.

    Reply
  17. Danny Pras
    Danny Pras March 24, 2011 at 10:40 am |

    I should try it, it would be nice to have this in wordpress, going to digg it up more.

    Reply
  18. Tim McCullen
    Tim McCullen April 4, 2011 at 8:44 am |

    OMG Justin thanks you for this post. This is EXACTLY what I was looking for on our new site. Posted to Twitter. THANK YOU!

    Reply
  19. AJ Clarke
    AJ Clarke April 8, 2011 at 7:59 pm |

    This is a sweet piece of code. I’m thinking this could be integrated really nicely with some sort of image gallery plugin on a photography style site. I will give this one a try. Thanks Justin!

    Reply
  20. Mark
    Mark April 9, 2011 at 11:35 am |

    That is a good code for wordpress. One thing I’m trying to do is making lightbox work only on attachment page, anyone tried that?

    Reply
  21. 21 Fresh WordPress Code Snippets and Detailed Tutorials
  22. Inviting Your Opinions for Photo Blogging Support » Aquoid Themes
  23. Will
    Will September 19, 2011 at 8:40 am |

    Excellent – I was looking all over for this and didn’t find it in the WP documentation. Thanks.

    Reply
  24. Gary Taylor
    Gary Taylor October 4, 2011 at 7:04 am |

    Once again, Justin, you deliver the goods!

    I’m developing a site for work, which will be a photo library. Wordpress resizes the images, and users can select a size for print, embedding or using as a thumbnail for our various sites (with various sizes – and yes, custom sizes work).

    Next step is to adapt your code to have have them linked by named size-types rather than their dimensions, and to exclude the thumbnail built-in size (because that’s used only by this site). Suspect the latter will be easier than the former – just need to exclude item [0] from the array…

    Gary

    Reply
  25. Alex
    Alex October 14, 2011 at 3:51 am |

    Justin thanks you for this post. I wonder where you get these crazy ideas!

    Reply
  26. Rafael Trabasso
    Rafael Trabasso December 12, 2011 at 7:00 pm |

    Congratulations, I was wondering if someone has already done this.
    Then I googled “Wordpress all image sizes”… : )

    Reply
  27. Jake
    Jake February 22, 2012 at 12:34 pm |

    Justin,
    Thank you for this post, incredibly helpful.

    Reply
  28. Pauro
    Pauro March 11, 2012 at 12:13 am |

    Thank you Justin, helpful as usual.
    Next step, I think it would be better to limit appeared sizes into full-large-middle only. The reason is, I don’t think anybody wants to click small 150×150 thumbnail, so I think it would be better if we can limit the sizes. Can you help to do this?

    Reply
  29. Martin Allien
    Martin Allien April 9, 2012 at 1:14 pm |

    Oh, this is amazing! As many others here, I really need this function and you made my life a lil’ easier :]

    Thanks and have a nice day!

    Reply
  30. Rabin
    Rabin April 21, 2012 at 9:34 am |

    Is there any way to show the size for all images in the post? or even when using the [gallery] shortcode?
    If this can be done then please let us know, it will help me a lot.

    Reply
  31. Paul
    Paul August 24, 2012 at 3:41 pm |

    Hi,
    I would also be very interrested to hear how this should be implemented in a lightbox on ordinary pages.

    Kind regards

    Reply
  32. dann
    dann January 3, 2013 at 8:06 am |

    thanks, this really helped!!

    Reply
  33. Mike
    Mike January 7, 2013 at 7:17 pm |

    Is there a way to display category name and tags list at attachment page?

    Reply
  34. Piet
    Piet February 25, 2013 at 12:41 am |

    Although super useful code above, the post actually deals with image dimensions, not the size (as in bytes).

    Would you by any chance know of a good way to echo the file size (in bytes) on the single attachment page?

    Many thanks in advance.
    Piet

    Reply
  35. Stew
    Stew March 8, 2013 at 6:03 am |

    Not work for me, i’ve placed the code in the loop but no link show, please can help?
    thanks

    Reply

Leave a Reply

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/Web site in attribution.

Please use your real name or a pseudonym (i.e., pen name, alias, nom de plume) when commenting. If you add your site name, company name, or something completely random, I'll likely change it to whatever I want.