WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to make link to "large" image instead of full size? (24 posts)

  1. dariodev
    Member
    Posted 3 years ago #

    When you insert image into post there is option to link this image to larger image, but this larger image is always full-size of uploaded image. There is no option to choose size of target image. Is there some plugin or modification to make images linked to "large" ("large" is set in media settings) versions of images instead of full-size?

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    How large is your uploaded image and what are the dimensions of your Large image in Settings -> Media?

  3. Joseph
    Member
    Posted 3 years ago #

    I believe if you set the insert to Post URL (using attachment page) instead of File URL then it'll be whatever size you've set it to.

  4. dariodev
    Member
    Posted 3 years ago #

    Dimensions of Large image in Settings -> Media is Max Width 1024 and max Height 1024. When I upload larger images (eg.1600x1200) wordpress will upload this image and will create 3 more images; thumbnail, medium and large - as set in Settings -> Media. This far is ok.

    But, when you insert image into post and link this image to larger image you cannot choose size of this larger image - this larger image is not "Large" from Settings -> Media - this larger image is full-size of uploaded image. I need to find solution to make thumbnails (or wp-gallery images) link to "Large" versions of images instead of full size.

  5. esmi
    Forum Moderator
    Posted 3 years ago #

    Joseph is correct. For the default gallery, you'll need to add some extra options to the gallery shortcode:
    [gallery link="file"]

    http://codex.wordpress.org/Gallery_Shortcode

  6. dariodev
    Member
    Posted 3 years ago #

    No esmi, Joseph refers to something else, this is not answer to my question. I have just found two older threads with same question but nobody answered. http://wordpress.org/support/topic/how-to-point-gallery-items-to-large-image-versions?replies=3
    http://wordpress.org/support/topic/linking-images-to-medium-and-large-versions?replies=1

  7. dariodev
    Member
    Posted 3 years ago #

    Esmi, if you refer to something like this [gallery link="file" size="medium"] this is not the answer because this will create gallery of Medium sized images but target files will be full-size images, not the Large.

  8. Joseph
    Member
    Posted 3 years ago #

    Just to clarify, in case anyone is confused, the size I was referring to is the size set when inserting into a post, not the sizes in media setting.

    @dariodev
    If you always want it to link to the large size image then you'll need to somehow add the dimensions to the end of the image filename in the URL.

    Perhaps there's a filter hook that can be used?

  9. perywinkle
    Member
    Posted 3 years ago #

    I'd be interested in a solution for gallery shortcode linking to 'large' images not 'full'.
    WP makes a large, why not use it?
    Or even a custom defined size via the post-thumbnail feature.

    My users will be uploading gigantic files... so 'full' is not a option.

    It would be nice is there were something like this:
    [gallery link="file" attachment="full"]

  10. jaumesala
    Member
    Posted 3 years ago #

    I think its a great idea.

    Or even more a place in wordpress where you can set up de defult [gallery] options

    link= file | atachement
    attachement= thmubnal|medium|large|ful

    Then you will not have to put the code for each [gallery]

  11. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    attachment.php looks like an answer

    If you make one, your attachments would be shown on it

    http://themeshaper.com/2009/06/30/wordpress-theme-single-post-post-attachment-404-templates-tutorial/

    Has some info on it.... you would just need to call in the appropriate image size on an attachment.php template

  12. jaumesala
    Member
    Posted 3 years ago #

    Sorry, I think I'm not undertanding.

    the attachment.php relies on theme or in wordpress core files?

  13. perywinkle
    Member
    Posted 3 years ago #

    That's a theme file.
    If you create a attachment.php, in your theme directory, it will display for attachments in a more customized way. 'image.php' even more specifically.
    http://codex.wordpress.org/Template_Hierarchy

  14. jaumesala
    Member
    Posted 3 years ago #

    I recived you respons by email.

    Thank you

  15. stueynet
    Member
    Posted 3 years ago #

    This is very important for us purists that like using the gallery shortcode. You cannot use attachment.php if you are trying to link to the file. I agree with Mic's solution

    [gallery link="file" attachment="full"]

    If anyone has any ideas let me know. This can probably be done with a custom function / filter.

  16. stueynet
    Member
    Posted 3 years ago #

    Just found this plugin. Does exactly this and a lot more.

    http://wordpress.org/extend/plugins/cleaner-gallery

  17. jaumesala
    Member
    Posted 3 years ago #

    I will take a look to the plugin.

    I think in de [gallery] code WordPress can make a better job.

  18. jefflundberg
    Member
    Posted 3 years ago #

    I've been looking for a solution to the same issue. I wanted users the ability to upload full size images (4000px wide, for example), but when they inserted the image into their post, I wanted the image to link to the large size, instead of the full size. I used a filter to modify the admin screen using the attachment_fields_to_edit hook.

    Details here:
    http://posterous.jefflundberg.com/make-wordpress-image-link-to-large-image-inst

  19. evster
    Member
    Posted 2 years ago #

    Just want to note that I too was looking for this EXACT feature.

    Something along the lines of [gallery link="file" attachment="large"] would be great!

    I want to have my gallery thumbnails link to the WordPress auto-generated "large" image instead of the original full-sized image that was uploaded, but there does not seem to be an easy way to make this happen.

  20. cjldragon
    Member
    Posted 2 years ago #

    If you have already uploaded your images take a look at This adds a filter to the [gallery] shortcode to use the large image.

  21. photocurio
    Member
    Posted 2 years ago #

    Wow, nice work, C. J. L. Dragon! That's perfect.

  22. Grawl
    Member
    Posted 2 years ago #

    cjldragon's php script from his link helps Me too.

  23. tbradley22
    Member
    Posted 2 years ago #

    Wow yeah cjldragon's functions.php script was perfect. I just dropped it in and worked right form the get go.

  24. jaumesala
    Member
    Posted 2 years ago #

    Is there a way to make this code

    [gallery file=link]

    As wordpress default Code for galleries, instead of

    [gallery] wich results in [gallery file=attachement]

    Maybe this question is a bit out of topic

    Really thank you

Topic Closed

This topic has been closed to new replies.

About this Topic