47 Responses

  1. donnacha WordSkill
    donnacha WordSkill Published |

    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 Published |

    (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 Published |

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

      Reply
  3. Emil
    Emil Published |

    Wow this is amazing, good job as always.

    Cheers,
    Emil

    Reply
  4. Michael Beckwith
    Michael Beckwith Published |

    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 Published |

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

    Reply
  6. Andre
    Andre Published |

    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 Published |

    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
    1. aan
      aan Published |

      Great question!

      Bump this question since this isn’t answered yet and I have the same question, how to link to attachment with resized image from add size function.

      thanks!

      Reply
  8. Navin
    Navin Published |

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

    Reply
  9. Heather
    Heather Published |

    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 Published |

    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 Published |

    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 Published |

    I would like to see an example,looks interesting.

    Reply
  14. Ross
    Ross Published |

    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 Published |

    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 Published |

    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 Published |

    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 Published |

    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 Published |

    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 Published |

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

    Reply
  24. Gary Taylor
    Gary Taylor Published |

    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 Published |

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

    Reply
  26. Rafael Trabasso
    Rafael Trabasso Published |

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

    Reply
  27. Jake
    Jake Published |

    Justin,
    Thank you for this post, incredibly helpful.

    Reply
  28. Pauro
    Pauro Published |

    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 Published |

    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 Published |

    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 Published |

    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 Published |

    thanks, this really helped!!

    Reply
  33. Mike
    Mike Published |

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

    Reply
  34. Piet
    Piet Published |

    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 Published |

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

    Reply
  36. Harry Saggu
    Harry Saggu Published |

    Not working on my wp site ….. i can’t find image.php or attached.php page in my website directory.
    can you please help me to show this amazing feature on custom place.

    thanks

    Reply
  37. Darshak Parmar
    Darshak Parmar Published |

    Excellent piece of code. many thanks for that. Has anyone tried using this to show available sizes right below the images within a post and not on attachment pages?

    Reply
  38. Display All Image Sizes of Attached Image in WordPress - WPSnippy
  39. Usman
    Usman Published |

    The result is showing randomly not in sorting order From Low to High Resolution. Please correct it or tell me where to change the code get sorted result.

    150 × 150 / 300 × 225 / 1024 × 768 / 780 × 400 / 374 × 200 / 239 × 130 / 75 × 75 / 1152 × 864

    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.

css.php