WordPress.org

Ready to get started?Download WordPress

Forums

Sponsors Slideshow Widget
proportionately resized Images in sponsors slideshow 1.9.3 (1 post)

  1. papposilenus
    Member
    Posted 3 years ago #

    I've modified sponsors-slideshow-widget.php to resize images while keeping them proportional to the original dimensions. Replace lines 155-153 with

    list($width, $height) = getimagesize($link->link_image);
                            $xscale = $instance['width']/$width;
                            $yscale = $instance['height']/$height;
                            if (($xscale > 1) && ($yscale > 1)) {
                                $new_width = $width;
                                $new_height = $height;
                            } else if ($xscale > $yscale) {
                                $new_width = round($width * $yscale);
                                $new_height = round($height * $yscale);
                            } else {
                                $new_width = round($width * $xscale);
                                $new_height = round($height * $xscale);
                            }
    						echo '<img src="'.$link->link_image.'" alt="'.$link->link_name.'" height="'.$new_height.'" width="'.$new_width.'" />';
    					} else {
    						echo $link->link_name;
                        }

    http://wordpress.org/extend/plugins/sponsors-slideshow-widget/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

  • RSS feed for this topic
  • Started 3 years ago by papposilenus
  • This topic is not a support question
  • WordPress version: 3.1.1