Plugin Directory

Changeset 942368


Ignore:
Timestamp:
07/02/2014 06:57:50 PM (12 years ago)
Author:
huntermaster
Message:

improve stdthumb formatting

Location:
image-formatr/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • image-formatr/trunk/image-formatr.php

    r941673 r942368  
    44  * Plugin URI: http://warriorself.com/blog/about/image-formatr/
    55  * Description: Formats all content images on a page / post giving them captions and popups.
    6   * Version: 1.2.4
     6  * Version: 1.2.4.1
    77  * License: GPLv3
    88  * Author: Steven Almeroth
  • image-formatr/trunk/src/class.formatr.php

    r941673 r942368  
    155155            $image_atts  = $this->get_attributes($image_tag);
    156156
    157             // return the untouched markup if we can't find any attributes
     157            // return the untouched markup if we can't find any attributes: no src?
    158158            if (!count($image_atts)) return $orig_markup;
    159159
     
    194194
    195195            // return nothing if we're not on the right page
    196             // in effect this image gets deleted
     196            // in effect this image gets deleted, why are we doing this?
    197197            if ( ($image_atts['page'] == 'front'   and !is_front_page())
    198198              or ($image_atts['page'] == 'single'  and !is_single()    )
     
    228228                    $image_atts['class'] = str_replace($class, "", $image_atts['class']);
    229229
    230             return $this->format($image_atts);
     230            return $this->format($image_atts, $image_tag);
    231231        }
    232232
     
    234234         * Format the html output
    235235         *
     236         * @param array $param The image attributes/parameters as an associative array
    236237         * [alt] => IMG_4308
    237238         * [asis] =>
     
    255256         * [none] =>
    256257         *
    257          * @param array $param The image attributes/parameters as an associative array
     258         * @param string $image The image tag markup, with closing slash
     259         * <img src="..." .../>
     260         *
    258261         * @return string The screen markup
    259262         */
    260         function format ( $param )
     263        function format ( $param, $image )
    261264        {
    262265            // setup dimensions width & height /////////////////////////////////
     
    313316                $height = $img_height  ? "max-height: {$img_height}px;" : "";
    314317            }
    315             if ($this->get_option('stdthumb')) {
    316                 $image_style  = "style=\"$width $height\"";
    317                 $container_style = "style=\"width:{$img_width}px\"";
    318             } else {
    319                 $image_style = "";
    320                 $container_style = "";
    321             }
    322318
    323319            // setup source & id print variables ///////////////////////
     
    374370
    375371            $class = trim("{$this->add_class} {$param['class']}");
     372            $container_style = '';
     373
     374            if ($this->get_option('stdthumb')) {
     375                $container_style = 'style="width:{$img_width}px"';
     376                $image = <<< IMAGE
     377                  <img src="$src" alt="{$param['alt']}" style="$width $height" $title/>
     378IMAGE;
     379            }
    376380
    377381            return <<< DIV_A_IMG
    378382              <div $id class="$class" $container_style>
    379                 $anchor<img src="$src" alt="{$param['alt']}" $image_style $title/>$anchor_close
     383                $anchor$image$anchor_close
    380384                $caption
    381385              </div>
Note: See TracChangeset for help on using the changeset viewer.