Changeset 12691 for extensions/GThumb/js/gthumb.js
- Timestamp:
- Dec 3, 2011, 6:11:54 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/GThumb/js/gthumb.js
r12680 r12691 73 73 74 74 // Compute best size for landscape picture (we choose bigger height) 75 min_ratio = Math.min(1 , this.big_thumb.width/this.big_thumb.height);75 min_ratio = Math.min(1.05, this.big_thumb.width/this.big_thumb.height); 76 76 77 77 for(width = this.big_thumb.width; width/best_size.height>=min_ratio; width--) { … … 118 118 } 119 119 this.t[0].crop = best_size.width; 120 this.resize(first_thumb, this.big_thumb.width, this.big_thumb.height, best_size.width, best_size.height, 'crop');120 this.resize(first_thumb, this.big_thumb.width, this.big_thumb.height, best_size.width, best_size.height, true); 121 121 122 122 } … … 164 164 new_width = Math.round(new_width); 165 165 } 166 this.resize(jQuery('#gt'+thumb_process[j].id), thumb_process[j].width, thumb_process[j].height, new_width, new_height, this.method);166 this.resize(jQuery('#gt'+thumb_process[j].id), thumb_process[j].width, thumb_process[j].height, new_width, new_height, false); 167 167 168 168 width_count += new_width + this.margin; … … 177 177 // Last line does not need to be cropped 178 178 for (j=0;j<thumb_process.length;j++) { 179 this.resize(jQuery('#gt'+thumb_process[j].id), thumb_process[j].width, thumb_process[j].height, thumb_process[j].width, max_height, this.method);179 this.resize(jQuery('#gt'+thumb_process[j].id), thumb_process[j].width, thumb_process[j].height, thumb_process[j].width, max_height, false); 180 180 } 181 181 … … 185 185 }, 186 186 187 resize: function(thumb, width, height, new_width, new_height, method) { 188 189 if (method == 'resize') { 187 resize: function(thumb, width, height, new_width, new_height, is_big) { 188 189 if (this.method == 'resize') { 190 real_width = Math.min(new_width, width); 191 real_height = Math.min(new_height, height); 192 width_crop = 0; 193 height_crop = 0; 194 195 if (is_big) { 196 if (width - new_width > height - new_height) { 197 real_width = Math.round(new_height * width / height); 198 width_crop = Math.round((real_width - new_width)/2); 199 } else { 200 real_height = Math.round(new_width * height / width); 201 height_crop = Math.round((real_height - new_height)/2); 202 } 203 } 190 204 thumb.css({ 191 height: new_height+'px',192 width: new_width+'px'205 height: real_height+'px', 206 width: real_width+'px' 193 207 }); 194 height_crop = 0;195 width_crop = 0;196 208 } else { 197 209 thumb.css({height: '', width: ''});
Note: See TracChangeset
for help on using the changeset viewer.