Plugin Directory

Changeset 776306


Ignore:
Timestamp:
09/21/2013 10:05:56 AM (13 years ago)
Author:
amtyera
Message:
  1. fixed a bug of calling amtyThumb plugin
  2. now user can decide whether an image should be stretched or should be resized by ratio
Location:
amty-thumb-recent-post
Files:
6 added
2 edited

Legend:

Unmodified
Added
Removed
  • amty-thumb-recent-post/trunk/amtyThumb_posts.php

    r746570 r776306  
    88
    99Author: Amit Gupta
    10 Version: 8.0.1
     10Version: 8.1.1
    1111Author URI: http://article-stack.com/
    1212*/
     
    116116        </p>
    117117
     118        <p>
     119            <select id="<?php echo $this->get_field_id( 'constrain' ); ?>" name="<?php echo $this->get_field_name( 'constrain' ); ?>" style="width:100px;" >
     120                <option <?php if ( 'stretch' == $instance['widgettype'] ) echo 'selected="selected"'; ?>>stretch</option>
     121                <option <?php if ( 'Resize by ratio' == $instance['widgettype'] ) echo 'selected="selected"'; ?>>Resize by ratio</option>
     122            </select>
     123        </p>
    118124        <!-- Show default image Checkbox -->
    119125        <?php /*<p>
     
    163169        $width = $instance['width'];
    164170        $height = $instance['height'];
     171        $constrain = $instance['constrain'];
    165172        $maxpost = $instance['maxpost'];
    166173        $default_img_path = $instance['default_img_path'];          //path for default image in case of no image in post
     
    177184       
    178185       
    179         displayPosts($before_title ,$after_title,$title, $width ,$height ,$maxpost ,$default_img_path,$pretag ,$template,$posttag,$titlelen,$contentlength ,$categoryName ,$widgetType);
     186        displayPosts($before_title ,$after_title,$title, $width ,$height , $constrain, $maxpost ,$default_img_path,$pretag ,$template,$posttag,$titlelen,$contentlength ,$categoryName ,$widgetType);
    180187        /* After widget (defined by themes). */
    181188        echo $after_widget;
     
    189196                     'thumb_width' => '70',
    190197                     'thumb_height' => '70',
     198                     'constrain' => '1',
    191199                     'default_img_path' => '',
    192200                     'pretag' => '',
     
    200208                     ), $attr ) );
    201209
    202 displayPosts($before_title, $after_title,$title, $thumb_width,$thumb_height,$max_post,$default_img_path,$pretag,$template,$posttag,$title_len,$contentlength,$category,$widgettype);
    203 
    204 }
    205 
    206 
    207 function displayPosts($before_title, $after_title, $title = '',$width = 70,$height = 70 ,$maxpost  = 10 ,$default_img_path = '',$pretag = '',$template , $posttag = '',$titlelen = 30,$contentlength=200,$categoryName = 'All',$widgetType = 'Recently Written'){
     210displayPosts($before_title, $after_title,$title, $thumb_width,$thumb_height,$constrain,$max_post,$default_img_path,$pretag,$template,$posttag,$title_len,$contentlength,$category,$widgettype);
     211
     212}
     213
     214
     215function displayPosts($before_title, $after_title, $title = '',$width = 70,$height = 70 ,$constrain=1, $maxpost  = 10 ,$default_img_path = '',$pretag = '',$template , $posttag = '',$titlelen = 30,$contentlength=200,$categoryName = 'All',$widgetType = 'Recently Written'){
    208216    global $wpdb;
    209217    if ( $title != '' ){
     
    283291                    //Do nothing
    284292                }else{
    285                     $imgpath = lead_img_thumb_post($width ,$height ,$default_img_path , $post->ID );
     293                    $imgpath = lead_img_thumb_post($width ,$height ,$default_img_path , $post->ID , $constrain);
    286294                    //echo "<br />" . $imgpath;
    287295                    $temp = str_replace("%POST_THUMB%", $imgpath , $temp);
     
    304312    if (function_exists('amty_lead_img')) {
    305313        if($post_id != '')
    306           $img_url = amty_lead_img($w,$h,1,$default_src,'',0,$post_id);
     314          $img_url = amty_lead_img($w,$h,1,'','',0,$post_id,'',$default_src);
    307315        else
    308           $img_url = amty_lead_img($w,$h,1,'','',0,'');
     316          $img_url = amty_lead_img($w,$h,1,'','',0,'','',$default_src);
     317    }
     318    else{
     319        echo "amtyThumb plugin is missing";
     320        $img_url = "";
     321    }
     322    return $img_url;
     323}//function end
     324
     325function lead_img_thumb_post($w=70,$h=70,$default_src='',$post_id,$constrain) {
     326   
     327    if (function_exists('amty_lead_img')) {
     328        if($post_id != '')
     329          $img_url = amty_lead_img($w,$h,$constrain,'','',0,$post_id,'y',$default_src);
     330        else
     331          $img_url = amty_lead_img($w,$h,$constrain,'','',0,'','y',$default_src);
    309332    }
    310333    else{
  • amty-thumb-recent-post/trunk/readme.txt

    r746566 r776306  
    44Tags: thumbnail, recent, random, popular, post, amty, image, widget, shortcode, mostly-viewed, rarely-viewed, recently-viewed, most-commented, last-viewed
    55Requires at least: 3.0
    6 Tested up to: 3.2
    7 Stable tag: 8.0.1
     6Tested up to: 3.5
     7Stable tag: 8.1.1
    88
    99All-In-One. It shows Recently written, Recently viewed, Random, Mostly & Rarely Viewd, Mostly Commented posts with thumbnail in your style.
     
    6262    'thumb_width' => '70',
    6363    'thumb_height' => '70',
     64    'constrain' => '1',
    6465    'default_img_path' => '', //should be set
    6566    'pretag' => '',
     
    116117
    117118== Changelog ==
     119
     120= 8.1.1 =
     121* fixed a bug of calling amtyThumb plugin
     122* Now user can decide wheter an image should resized in ratio or be stretched as per given dimentions.
     123
    118124
    119125= 8.0.1 =
     
    176182== Upgrade Notice ==
    177183
    178 = 7.1.0 =
    179 * Addtion of %SHORT_TITLE% template code to display short title
     184= 8.1.1 =
     185* fixed a bug of calling amtyThumb plugin
     186* Now user can decide wheter an image should resized in ratio or be stretched as per given dimentions.
     187
     188
     189= 8.0.1 =
     190* fixed a vry minor and silly bug of broken image
     191
     192= 8.0.0 =
     193* change in template codes for better customized apperance
     194* removed dependecny from 2 external plugins for analysing number of views and last visit time.
     195* Now you can display stripped post content
     196* extra functions to get views count or last visit time
     197* admin panel for admin to view posts stats.
     198* small code imporvment to spped up processing
Note: See TracChangeset for help on using the changeset viewer.