Changeset 694297
- Timestamp:
- 04/09/2013 06:00:44 AM (13 years ago)
- Location:
- image-formatr/trunk
- Files:
-
- 4 edited
-
class.admin.php (modified) (6 diffs)
-
class.formatr.php (modified) (3 diffs)
-
image-formatr.php (modified) (2 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
image-formatr/trunk/class.admin.php
r687268 r694297 18 18 'force' => "", 19 19 'stdthumb' => "on", 20 'attthumb' => "fullsize", 20 21 'killanc' => "on", 21 22 'inspect' => "", … … 91 92 'NOTE: may cause pages with lots of images to load slowly.'), 92 93 ), 94 'imgdefs' => array( 95 'name' => 'imglong, imgshort', 96 'title' => 'Default dimensions', 97 'desc' => 'These values will be used as the width & height.', 98 'html' => array('These values will be used as the width & height in pixels by the <em>Auto determine orientation</em> setting which, if disabled will default to the <code>width</code> in the first box and the <code>height</code> in second box.', 99 'NOTE: leave one of the boxes blank (or zero) and it will be calculated using the aspect ratio to the other box.'), 100 ), 101 'imgaddl' => array( 102 'name' => 'img2long, img2short, img2page', 103 'title' => 'Additional dimensions', 104 'desc' => 'These values will be used as the width & height.', 105 'html' => array('These dimensions are used if you want to specify different settings for the front page or the single display page or everything else.', 106 'These values will be used as the width & height in pixels by the <em>Auto determine orientation</em> setting which, if disabled will default to the <code>width</code> in the first box and the <code>height</code> in second box.', 107 'NOTE: leave one of the boxes blank (or zero) and it will be calculated using the aspect ratio to the other box.'), 108 ), 109 'attthumb' => array( 110 'title' => 'Use attached image as thumbnail', 111 'desc' => 'Select the size to use for the thumbnail with Wordpress attachment images, if available.', 112 'html' => array('If you attached an image to a post/page using the Wordpress <em>Add Media</em> button or through the <em>Media Library</em>, then you can use one of the auto-generated smaller sizes as the thumbnail.', 113 'Non-attached images will just use the full-size image as the thumbnail and if the attached image size you specify is not available, the full-size image will also be used.'), 114 ), 93 115 'addclass' => array( 94 116 'title' => 'Additional classes', … … 160 182 '<em>Remember: the database is cleaned up when you "Deactivate"</em>.'), 161 183 ), 162 163 'imgdefs' => array(164 'name' => 'imglong, imgshort',165 'title' => 'Default dimensions',166 'desc' => 'These values will be used as the width & height.',167 'html' => array('These values will be used as the width & height in pixels by the <em>Auto determine orientation</em> setting which, if disabled will default to the <code>width</code> in the first box and the <code>height</code> in second box.',168 'NOTE: leave one of the boxes blank (or zero) and it will be calculated using the aspect ratio to the other box.'),169 ),170 'imgaddl' => array(171 'name' => 'img2long, img2short, img2page',172 'title' => 'Additional dimensions',173 'desc' => 'These values will be used as the width & height.',174 'html' => array('These dimenstions are used if you want to specify different settings for the front page or the single display page or everything else.',175 'These values will be used as the width & height in pixels by the <em>Auto determine orientation</em> setting which, if disabled will default to the <code>width</code> in the first box and the <code>height</code> in second box.',176 'NOTE: leave one of the boxes blank (or zero) and it will be calculated using the aspect ratio to the other box.'),177 ),178 184 ); 179 185 … … 184 190 185 191 add_settings_section('main_section', 'Main settings', array($this, 'admin_overview'), __FILE__); 186 $this-> add_settings(array('capatt' ), 'print_ dropdown', 'main_section');187 $this-> add_settings(array('newtitle'), 'print_textbox' , 'main_section');188 $this-> add_settings(array('group' ), 'print_textbox' , 'main_section');192 $this-> add_settings(array('capatt' ), 'print_caption_dd', 'main_section'); 193 $this-> add_settings(array('newtitle'), 'print_textbox' , 'main_section'); 194 $this-> add_settings(array('group' ), 'print_textbox' , 'main_section'); 189 195 $this-> add_settings(array('yankit', 'killanc', 'dofx', 'force'), 'print_checkbox', 'main_section'); 190 196 191 197 add_settings_section('thumb_section', 'Thumbnail settings', array($this, 'admin_overview'), __FILE__); 192 $this-> add_settings(array('stdthumb'), 'print_checkbox', 'thumb_section'); 193 $this-> add_settings(array('inspect' ), 'print_checkbox', 'thumb_section'); 194 $this-> add_settings(array('imgdefs' ), 'print_img_defs', 'thumb_section'); 195 $this-> add_settings(array('imgaddl' ), 'print_img_addl', 'thumb_section'); 198 $this-> add_settings(array('stdthumb'), 'print_checkbox' , 'thumb_section'); 199 $this-> add_settings(array('inspect' ), 'print_checkbox' , 'thumb_section'); 200 $this-> add_settings(array('imgdefs' ), 'print_img_defs' , 'thumb_section'); 201 $this-> add_settings(array('imgaddl' ), 'print_img_addl' , 'thumb_section'); 202 $this-> add_settings(array('attthumb' ), 'print_attach_dd', 'thumb_section'); 196 203 197 204 add_settings_section('style_section', 'Styling settings', array($this, 'admin_overview'), __FILE__); … … 212 219 } 213 220 214 function print_ dropdown( $f )221 function print_caption_dd ( $f ) 215 222 { 216 223 $sel_tit = ($this->get_option($f) == 'title') ? 'selected="selected"' : ''; … … 224 231 <option value="alt" $sel_alt>alt</option> 225 232 <option value="x" $sel_non>(x) no caption</option> 233 </select> 234 ELEMENT; 235 $this-> print_element($e, $f); 236 } 237 238 function print_attach_dd ( $f ) 239 { 240 $sel_thu = ($this->get_option($f) == 'thumbnail') ? 'selected="selected"' : ''; 241 $sel_med = ($this->get_option($f) == 'medium' ) ? 'selected="selected"' : ''; 242 $sel_lrg = ($this->get_option($f) == 'large' ) ? 'selected="selected"' : ''; 243 $sel_ful = ($this->get_option($f) == 'fullsize' ) ? 'selected="selected"' : ''; 244 $e = <<< ELEMENT 245 <select 246 id="$f" 247 name="$this->settings_name[$f]" 248 ><option value="fullsize" $sel_ful>full-size</option> 249 <option value="large" $sel_lrg>large</option> 250 <option value="medium" $sel_med>medium</option> 251 <option value="thumbnail" $sel_thu>thumbnail</option> 226 252 </select> 227 253 ELEMENT; -
image-formatr/trunk/class.formatr.php
r687268 r694297 41 41 $this->cap_class = $this->get_option('capclass' ); // list of css classes to add to the caption div 42 42 $this->def_group = $this->get_option('group' ); // the default PrettyPhoto grouping designator 43 $this->attach_thumb = $this->get_option('attthumb' ); // the size of the attachment image to use as the thumbnail 43 44 $this->new_title = __($this->get_option('newtitle' )); // the new title replacement 44 45 $this->def_img_width = abs(intval($this->get_option('imglong' ))); … … 400 401 $img_style = "style=\"$width $height\""; 401 402 402 // setup print source and id print variables /////////////// 403 $src = $param['thumb'] ? $param['thumb'] : $param['src']; 403 // setup source & id print variables /////////////////////// 404 $thumb = $param['thumb'] ? $param['thumb'] : $this-> get_attachment_url($param); 405 $src = $thumb ? $thumb : $param['src']; 404 406 $id = $param['id'] ? "id=\"{$param['id']}\"" : ""; 405 407 … … 459 461 } 460 462 463 /** 464 * Get the attached image url in the specified size 465 * 466 * First we look in the class parameter of the image for the attachment 467 * id and failing this we look in the database. Then we use this id to 468 * try and grab the attached image of that size. 469 */ 470 function get_attachment_url( $param ) 471 { 472 # first check if the attachment id is available in the image class 473 preg_match('/wp-image-(\d+)/', $param['class'], $matches); // alignnone size-full wp-image-3338 474 if (false and count($matches) > 1){ 475 $attachment_id = $matches[1]; 476 } 477 # otherwise we need to go to the database to find the id 478 else { 479 global $wpdb; 480 $psrc = $param['src']; 481 $query = "SELECT ID FROM $wpdb->posts WHERE guid='{$param['src']}'"; 482 // $debug_sma_eval ='$psrc';$debug_sma_title=__METHOD__.':'.__LINE__;include('debug_output_sma.php'); #SMA 483 // $debug_sma_eval ='$query';$debug_sma_title=__METHOD__.':'.__LINE__;include('debug_output_sma.php'); #SMA 484 $attachment_id = $wpdb->get_var($query); 485 } 486 # if the image has been attached, we should have the id now 487 if ($attachment_id) { 488 $attachment_img_src = wp_get_attachment_image_src($attachment_id, $this-> attach_thumb); 489 // $debug_sma_eval ='$attachment_img_src';$debug_sma_title=__METHOD__.':'.__LINE__;include('debug_output_sma.php'); #SMA 490 491 if ($attachment_img_src and isset($attachment_img_src[0])) 492 return $attachment_img_src[0]; 493 } 494 } 495 461 496 } //End Class ImageFormatr 462 497 -
image-formatr/trunk/image-formatr.php
r687268 r694297 4 4 * Plugin URI: http://warriorself.com/blog/about/image-formatr/ 5 5 * Description: Formats all content images on a page / post giving them borders and captions. 6 * Version: 1. 0.16 * Version: 1.1 7 7 * Author: Steven Almeroth 8 8 * Author URI: http://warriorship.org/sma/ … … 27 27 */ 28 28 define ('IMAGEFORMATR_TEXTDOMAIN', 'image-formatr'); 29 define( 'IMAGEFORMATR_VERSION' , '1.0.1');30 29 31 30 include_once(dirname(__FILE__) . '/class.formatr.php'); -
image-formatr/trunk/readme.txt
r687272 r694297 165 165 166 166 * add screenshot of output image with caption 167 * admin options name should be unique (accross all plugins) 167 168 168 169 == Current Wishlist ==
Note: See TracChangeset
for help on using the changeset viewer.