• When I’, inserting image in text (inline through visual editor) there is text field for “Link URL” with three buttons (none, file url, post url).

    I want to make a link to resized image (medium or large), because original is usualy to big.

    I know, I cau use “Post Url”, but I need just image url, to show images in lightbox.

    As I understand the code I think I need function similar to wp_get_attachment_thumb_url (wp_get_attachment_medium_url), but I lost myself while trying to make it.

    thanks, for you help

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter matejl

    (@matejl)

    Found the solution … you need to edit wp-admin/includes/media.php

    function image_link_input_fields($post, $url_type = '') {
    
    	//$file = wp_get_attachment_url($post->ID);
    	$aFile = wp_get_attachment_image_src($post->ID, 'large');
    	$file = $aFile[0];
    
    	$link = get_attachment_link($post->ID);
    	...

    Problem with this solution is if you modify image (reupload image with different dimensions) the link will become invalid.

    Is there an update on this matter? Does anyone know a plugin or something enabling us to choose to link to another image than the full size one?

    I would love some tip on this one as well…

    How is it that there’s still no plugin for this – or better yet it’s not a built in WP feature??

    There is an easy way to add an additional button with a filter in your functions.php template file…

    Solution by Oleg Butuzov

    I’m playing around with this filter to make ‘medium image’ and ‘none’ the only two options.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘creating link to large/medium image while inserting in text’ is closed to new replies.