r78917 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78916‎ | r78917 | r78918 >
Date:19:32, 23 December 2010
Author:dale
Status:deferred
Tags:
Comment:
fixed issue of small svn images being set as image source without image flattening transform
Modified paths:
  • /branches/MwEmbedStandAlone/modules/AddMedia/mw.RemoteSearchDriver.js (modified) (history)

Diff [purge]

Index: branches/MwEmbedStandAlone/modules/AddMedia/mw.RemoteSearchDriver.js
@@ -2116,38 +2116,31 @@
21172117
21182118 mw.log( 'did append to: ' + _this.target_container );
21192119
2120 - // issue a loadResourceImage request if needed ( image is > than target display resolution )
2121 - if ( mediaType == 'image' && resource.width > targetWidth ) {
2122 - _this.loadResourceImage(
2123 - resource,
2124 - {
2125 - 'width': targetWidth,
2126 - 'height' : targetHeight
2127 - },
2128 - function( img_src ) {
2129 - $j('#clip_edit_disp').empty().append(
2130 - $j( '<img />' )
2131 - .attr( {
2132 - 'id' : 'rsd_edit_img',
2133 - 'src' : img_src,
2134 - 'width': targetWidth,
2135 - 'height' : targetHeight
2136 - } )
2137 - );
2138 - }
2139 - );
2140 - } else if ( mediaType == 'image' ) {
2141 - //Just use the asset url directly
2142 - $j('#clip_edit_disp').empty().append(
2143 - $j( '<img />' )
2144 - .attr( {
2145 - 'id' : 'rsd_edit_img',
2146 - 'src' : resource.src,
2147 - 'width' : resource.width,
2148 - 'height' : resource.height
2149 - } )
2150 - )
2151 - }
 2120+ // check if the size is small
 2121+ if( resource.width < targetWidth ){
 2122+ targetWidth = resource.width;
 2123+ targetHeight = resource.height;
 2124+ }
 2125+
 2126+ // issue a loadResourceImage request:
 2127+ _this.loadResourceImage(
 2128+ resource,
 2129+ {
 2130+ 'width': targetWidth,
 2131+ 'height' : targetHeight
 2132+ },
 2133+ function( img_src ) {
 2134+ $j('#clip_edit_disp').empty().append(
 2135+ $j( '<img />' )
 2136+ .attr( {
 2137+ 'id' : 'rsd_edit_img',
 2138+ 'src' : img_src,
 2139+ 'width': targetWidth,
 2140+ 'height' : targetHeight
 2141+ } )
 2142+ );
 2143+ }
 2144+ );
21522145
21532146 // Also fade in the container:
21542147 $j( '#rsd_resource_edit' ).animate( {

Status & tagging log