WordPress.org

Ready to get started?Download WordPress

Forums

How can I set image size in media manager to "Full Size" as default (6 posts)

  1. kujina
    Member
    Posted 5 years ago #

    What do I have to edit, to set "image size" in media manager to "Full Size" as the default, instead of medium?

    I have a feeling its something in media.php, somebody point me in the right direction ; )

  2. krembo99
    Member
    Posted 5 years ago #

    ok.
    HANDLE WITH CARE AND BACKUP YOUR FILES BEFORE DOING THAT .
    what you look for is not in media.php but in upload.js inside js folder inside wp-admin folder. around line 126.

    and in file script-loader.php inside wp-includes folder around line 130 you will find this :

    'thumb' => __('Thumbnail'),
    'full' => __('Full size'),
    'icon' => __('Icon'),
    'title' => __('Title'),

    this givees a "name" to the options for the jscript.

    Modify on your own risk

  3. kujina
    Member
    Posted 5 years ago #

    Hi thanks for the response, I have looked at upload.js and I cant work out what I need to do. There is no mention of "medium" anywhere in upload.js or script-loader.php, only full and thumb.

    Are these the lines I should focus on?

    var display = [];
    			var checkedDisplay = 'display-title';
    			if ( 1 == this.currentImage.isImage ) {
    				checkedDisplay = 'display-full';
    				if ( this.currentImage.thumb ) {
    					display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> " + this.thumb + "</label>");
    					checkedDisplay = 'display-thumb';
    				}
    				display.push("<label for='display-full'><input type='radio' name='display' id='display-full' value='full' /> " + this.full + "</label>");
    			} else if ( this.currentImage.thumb ) {
    				display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> " + this.icon + "</label>");
    			}
    			if ( display.length ) {
    				display.push("<label for='display-title'><input type='radio' name='display' id='display-title' value='title' /> " + this.title + "</label>");
    				h += "<tr><th style='padding-bottom:.5em'>" + this.show + "</th><td style='padding-bottom:.5em'>";
    				jQuery(display).each( function() { h += this; } );
    				h += "</td></tr>";
    			}
  4. hvianna
    Member
    Posted 5 years ago #

    Found this topic looking for the same solution. Kujina, you were right from the start! I was able to change the default size in wp-admin/includes/media.php, in the following section: (starting line 452)

    $form_fields['image-size'] = array(
    			'label' => __('Size'),
    			'input' => 'html',
    			'html'  => "
    				" . ( $thumb ? "<input type='radio' name='attachments[$post->ID][image-size]' id='image-size-thumb-$post->ID' value='thumbnail' />
    				<label for='image-size-thumb-$post->ID'>" . __('Thumbnail') . "</label>
    				" : '' ) . "<input type='radio' name='attachments[$post->ID][image-size]' id='image-size-medium-$post->ID' value='medium' checked='checked' />
    				<label for='image-size-medium-$post->ID'>" . __('Medium') . "</label>
    				<input type='radio' name='attachments[$post->ID][image-size]' id='image-size-full-$post->ID' value='full' />
    				<label for='image-size-full-$post->ID'>" . __('Full size') . "</label>",
    		);

    just move the checked='checked' attribute to the option you want to be the default. You can also change the default image alignment, it's a few lines up.

    Hope that helps. It would be nice to see this as a configuration option in future releases :)

  5. Dave
    Member
    Posted 5 years ago #

    Sweet. Editing the media.php worked a charm for me too. What about removing the automatic link? Suggestions there?

  6. alainS
    Member
    Posted 5 years ago #

    Tnx for the solution!

Topic Closed

This topic has been closed to new replies.

About this Topic