1<?php 2/** 3 * Media settings administration panel. 4 * 5 * @package WordPress 6 * @subpackage Administration 7 */ 8 9/** WordPress Administration Bootstrap */ 10require_once __DIR__ . '/admin.php'; 11 12if ( ! current_user_can( 'manage_options' ) ) { 13 wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) ); 14} 15 16$title = __( 'Media Settings' ); 17$parent_file = 'options-general.php'; 18 19$media_options_help = '<p>' . __( 'You can set maximum sizes for images inserted into your written content; you can also insert an image as Full Size.' ) . '</p>'; 20 21if ( ! is_multisite() 22 && ( get_option( 'upload_url_path' ) 23 || get_option( 'upload_path' ) && 'wp-content/uploads' !== get_option( 'upload_path' ) ) 24) { 25 $media_options_help .= '<p>' . __( 'Uploading Files allows you to choose the folder and path for storing your uploaded files.' ) . '</p>'; 26} 27 28$media_options_help .= '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>'; 29 30get_current_screen()->add_help_tab( 31 array( 32 'id' => 'overview', 33 'title' => __( 'Overview' ), 34 'content' => $media_options_help, 35 ) 36); 37 38get_current_screen()->set_help_sidebar( 39 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . 40 '<p>' . __( '<a href="https://wordpress.org/support/article/settings-media-screen/">Documentation on Media Settings</a>' ) . '</p>' . 41 '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' 42); 43 44require_once ABSPATH . 'wp-admin/admin-header.php'; 45 46?> 47 48<div class="wrap"> 49<h1><?php echo esc_html( $title ); ?></h1> 50 51<form action="options.php" method="post"> 52<?php settings_fields( 'media' ); ?> 53 54<h2 class="title"><?php _e( 'Image sizes' ); ?></h2> 55<p><?php _e( 'The sizes listed below determine the maximum dimensions in pixels to use when adding an image to the Media Library.' ); ?></p> 56 57<table class="form-table" role="presentation"> 58<tr> 59<th scope="row"><?php _e( 'Thumbnail size' ); ?></th> 60<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Thumbnail size' ); ?></span></legend> 61<label for="thumbnail_size_w"><?php _e( 'Width' ); ?></label> 62<input name="thumbnail_size_w" type="number" step="1" min="0" id="thumbnail_size_w" value="<?php form_option( 'thumbnail_size_w' ); ?>" class="small-text" /> 63<br /> 64<label for="thumbnail_size_h"><?php _e( 'Height' ); ?></label> 65<input name="thumbnail_size_h" type="number" step="1" min="0" id="thumbnail_size_h" value="<?php form_option( 'thumbnail_size_h' ); ?>" class="small-text" /> 66</fieldset> 67<input name="thumbnail_crop" type="checkbox" id="thumbnail_crop" value="1" <?php checked( '1', get_option( 'thumbnail_crop' ) ); ?>/> 68<label for="thumbnail_crop"><?php _e( 'Crop thumbnail to exact dimensions (normally thumbnails are proportional)' ); ?></label> 69</td> 70</tr> 71 72<tr> 73<th scope="row"><?php _e( 'Medium size' ); ?></th> 74<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Medium size' ); ?></span></legend> 75<label for="medium_size_w"><?php _e( 'Max Width' ); ?></label> 76<input name="medium_size_w" type="number" step="1" min="0" id="medium_size_w" value="<?php form_option( 'medium_size_w' ); ?>" class="small-text" /> 77<br /> 78<label for="medium_size_h"><?php _e( 'Max Height' ); ?></label> 79<input name="medium_size_h" type="number" step="1" min="0" id="medium_size_h" value="<?php form_option( 'medium_size_h' ); ?>" class="small-text" /> 80</fieldset></td> 81</tr> 82 83<tr> 84<th scope="row"><?php _e( 'Large size' ); ?></th> 85<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Large size' ); ?></span></legend> 86<label for="large_size_w"><?php _e( 'Max Width' ); ?></label> 87<input name="large_size_w" type="number" step="1" min="0" id="large_size_w" value="<?php form_option( 'large_size_w' ); ?>" class="small-text" /> 88<br /> 89<label for="large_size_h"><?php _e( 'Max Height' ); ?></label> 90<input name="large_size_h" type="number" step="1" min="0" id="large_size_h" value="<?php form_option( 'large_size_h' ); ?>" class="small-text" /> 91</fieldset></td> 92</tr> 93 94<?php do_settings_fields( 'media', 'default' ); ?> 95</table> 96 97<?php 98/** 99 * @global array $wp_settings 100 */ 101if ( isset( $GLOBALS['wp_settings']['media']['embeds'] ) ) : 102 ?> 103<h2 class="title"><?php _e( 'Embeds' ); ?></h2> 104<table class="form-table" role="presentation"> 105 <?php do_settings_fields( 'media', 'embeds' ); ?> 106</table> 107<?php endif; ?> 108 109<?php if ( ! is_multisite() ) : ?> 110<h2 class="title"><?php _e( 'Uploading Files' ); ?></h2> 111<table class="form-table" role="presentation"> 112 <?php 113 /* 114 * If upload_url_path is not the default (empty), 115 * or upload_path is not the default ('wp-content/uploads' or empty), 116 * they can be edited, otherwise they're locked. 117 */ 118 if ( get_option( 'upload_url_path' ) 119 || get_option( 'upload_path' ) && 'wp-content/uploads' !== get_option( 'upload_path' ) ) : 120 ?> 121<tr> 122<th scope="row"><label for="upload_path"><?php _e( 'Store uploads in this folder' ); ?></label></th> 123<td><input name="upload_path" type="text" id="upload_path" value="<?php echo esc_attr( get_option( 'upload_path' ) ); ?>" class="regular-text code" /> 124<p class="description"> 125 <?php 126 /* translators: %s: wp-content/uploads */ 127 printf( __( 'Default is %s' ), '<code>wp-content/uploads</code>' ); 128 ?> 129</p> 130</td> 131</tr> 132 133<tr> 134<th scope="row"><label for="upload_url_path"><?php _e( 'Full URL path to files' ); ?></label></th> 135<td><input name="upload_url_path" type="text" id="upload_url_path" value="<?php echo esc_attr( get_option( 'upload_url_path' ) ); ?>" class="regular-text code" /> 136<p class="description"><?php _e( 'Configuring this is optional. By default, it should be blank.' ); ?></p> 137</td> 138</tr> 139<tr> 140<td colspan="2" class="td-full"> 141<?php else : ?> 142<tr> 143<td class="td-full"> 144<?php endif; ?> 145<label for="uploads_use_yearmonth_folders"> 146<input name="uploads_use_yearmonth_folders" type="checkbox" id="uploads_use_yearmonth_folders" value="1"<?php checked( '1', get_option( 'uploads_use_yearmonth_folders' ) ); ?> /> 147 <?php _e( 'Organize my uploads into month- and year-based folders' ); ?> 148</label> 149</td> 150</tr> 151 152 <?php do_settings_fields( 'media', 'uploads' ); ?> 153</table> 154<?php endif; ?> 155 156<?php do_settings_sections( 'media' ); ?> 157 158<?php submit_button(); ?> 159 160</form> 161 162</div> 163 164<?php require_once ABSPATH . 'wp-admin/admin-footer.php'; ?> 165