Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi kemeredith,

    add a class name to the image under “Additional Details” in the Link Sub-Field Configuration table. For example, if you add the class “small_link_img”, your entry in the css file you use would be:

    .small_link_img {
      width=200px;
    }

    -mallards66

    This seems to work for custom image sizes. Add this to functions.php. Move Meta box up to default uploader. Dont know how to remove default uploader buttons.

    /**
     * Add JS for the media-editor to the add/edit link screen
     *
     * @author Hiranthi Molhoek-Herlaar
     * @since 1.0
     *
     * @return void
     **/
    function onexa_blogroll_image_js ()
    {
    	if ( strstr($_SERVER['PHP_SELF'],'link.php') || strstr($_SERVER['PHP_SELF'],'link-add.php') )
    	{
    ?>
    	<script type="text/javascript">
    	//<![CDATA[
    	var current_image = '';
    
    	function send_to_editor(html) {
    		var source = html.match(/src=\".*\" alt/);
    		source = source[0].replace(/^src=\"/, "").replace(/" alt$/, "");
    
    		document.getElementById('link_image').value = source;
    
    		tb_remove();
    	}
    
    	jQuery(document).ready(function($) {
    
    		$('label[for=link_image]').append(' <a href="media-upload.php?post_id=x<?php echo time() ?>&width=640&height=447&TB_iframe=1" id="add_image" class="thickbox" title="<?php _e('Add/Change Link image', 'iwd'); ?>" onclick="return false;"><img src="images/media-button.png?ver=20111005" alt="<?php _e('Add Link image', 'blogroll_image'); ?>" /></a>');
    
    		$('#link_image').change(function() {
    		    if ( $(this).val().length > 0 )
    		    {
    		    	// view image link doesn't exist yet
    		    	if ($('#link_image_view').length < 1)
    		    		$(this).fadeIn('slow').after('<a id="link_image_view" href="#" class="thickbox"><big></big></a>');
    		    	// view image link is hidden
    			  	if ( $('#link_image_view').css('display') == 'none' ) $('#link_image_view').fadeIn('slow');
    
    			    if ($('#link_image_view').length)
    				    $('#link_image_view').attr('href', $(this).val());
    		    }
    		    // length of the image URL == 0
    		    else
    		    {
    		    	$('#link_image_view').fadeOut('slow');
    		    }
    		}).blur(function() {
    			$(this).change();
    		});
    
    		if ( $('#link_image').val().length > 0 ) $('#link_image').change();
    	});
    	//]]>
    	</script>
    <?php
    	} // end if
    } // end blogroll_image_js
    add_action('admin_print_scripts','onexa_blogroll_image_js',99);
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to change link image to smaller thumbnail?’ is closed to new replies.