WordPress.org

Make WordPress Core

Opened 22 months ago

Closed 12 months ago

Last modified 12 months ago

#21114 closed enhancement (duplicate)

Add Link to Large Image in Add Media Window

Reported by: robertstaddon Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.4
Component: Media Keywords: has-patch ux-feedback
Focuses: Cc:

Description

Usually when an image thumbnail is inserted into a post, I would like the thumbnail to link to the large version of the image, not the full size version. Often the full size version is straight from a user's high-megapixel camera and takes a while to load, while the large version has been automatically downsized by Wordpress according to its media settings and works beautifully with a lightbox plugin or script.

Wordpress automatically creates a large version of the image, but unfortunately it does not support linking to the large version very easily at all from the Add Media window. This patch adds the option to link to either the Full Size Image or the Large Image from the Add Media window.

I've used the attached patch to the Wordpress core ever since the version 2 era. I thought I'd try submitting it as an enhancement so I that I won't have to keep manually applying it every time that I upgrade Wordpress.

One note: The line that says "$url = $fileLarge;" makes the large file the default link for an image. This may be too drastic of a change for Wordpress. However, most of my clients would vote that it should be the default, so I thought I'd try submitting it anyway. :) If other people disagree, then I could certainly remove that line of code so that the large image would be an option but not the default option.

Attachments (5)

media.php.patch (2.0 KB) - added by robertstaddon 22 months ago.
add-link-to-large-image.php (1.7 KB) - added by SergeyBiryukov 22 months ago.
In plugin form
media.php.2.patch (2.1 KB) - added by robertstaddon 22 months ago.
21114.after.png (20.3 KB) - added by SergeyBiryukov 22 months ago.
21114.after.disabled.png (20.5 KB) - added by SergeyBiryukov 22 months ago.

Download all attachments as: .zip

Change History (12)

robertstaddon22 months ago

comment:1 knutsp22 months ago

  • Cc knut@… added

+1

This a practical problem for me and clients. As the ticket author wants, I usually want to link to the large image and not the full size from camera. The full size will often be too large for a normal screen resolution, the resolution higher then needed on the web. I don't want to always have to resize the image in WordPress, or before upload, lazy as I am. This would be a nice enhancement.

Patch should make the users latest choice as the default for the next insert.

Last edited 22 months ago by knutsp (previous) (diff)

comment:2 scribu22 months ago

  • Component changed from General to Media

SergeyBiryukov22 months ago

In plugin form

comment:3 SergeyBiryukov22 months ago

I thought I'd try submitting it as an enhancement so I that I won't have to keep manually applying it every time that I upgrade Wordpress.

It's also currently possible to turn your patch into a plugin (add-link-to-large-image.php), so you don't have to edit the core file.

comment:4 follow-up: robertstaddon22 months ago

Wow, Sergey, thank you so much for writing that plugin! Beautifully written. It will be a real help.

Perhaps I should release your plugin publicly before suggesting a patch to the Wordpress core. Somehow, though, I still think that this would be a really helpful addition to Wordpress. What do you think? The above +1 from knutsp seemed to reinforce this idea. I've rewritten the patch with your updated plugin code and also disabled the "Large Image" button if it is the same as the "Full Size" image.

What do you think about media.php.2.patch?

Thank you again!

SergeyBiryukov22 months ago

comment:5 in reply to: ↑ 4 SergeyBiryukov22 months ago

  • Keywords ux-feedback added; needs-testing removed

Related: #19181 (suggests a filter for image_link_input_fields()).

Replying to robertstaddon:

Perhaps I should release your plugin publicly before suggesting a patch

Sure, go ahead. Glad you liked it.

What do you think about media.php.2.patch?

A change like this needs UX feedback. I've attached the screenshots after the patch.

comment:6 lekiend12 months ago

I tried but it doesn't work with WP 3.5.1.
Should it be possible to get a compatible version for WP 3.5.1 ?

Dimitri

comment:7 SergeyBiryukov12 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

I'm not yet familiar enough with the new Media API to update the plugin, but #24019 has a patch for the new media modal that covers this. Going to close as a duplicate of that ticket.

Last edited 12 months ago by SergeyBiryukov (previous) (diff)
Note: See TracTickets for help on using tickets.