芝麻web文件管理V1.00
编辑当前文件:/var/www/cognitio.in/wp-content/plugins/revslider/includes/aq-resizer.class.php
resize( $width, $height, $crop ) ) ) return false; $resized_file = $editor->save(); if ( ! is_wp_error( $resized_file ) ) { $resized_rel_path = str_replace( $upload_dir, '', $resized_file['path'] ); $img_url = $upload_url . $resized_rel_path; } else { return false; } } } // Okay, leave the ship. if ( true === $upscale ) remove_filter( 'image_resize_dimensions', array( $this, 'aq_upscale' ) ); // Return the output. if ( $single ) { // str return. $image = $img_url; } else { // array return. $image = array ( 0 => $img_url, 1 => $dst_w, 2 => $dst_h ); } return $image; } /** * Callback to overwrite WP computing of thumbnail measures */ function aq_upscale( $default, $orig_w, $orig_h, $dest_w, $dest_h, $crop ) { if ( ! $crop ) return null; // Let the wordpress default function handle this. // Here is the point we allow to use larger image size than the original one. $aspect_ratio = $orig_w / $orig_h; $new_w = $dest_w; $new_h = $dest_h; if ( ! $new_w ) { $new_w = intval( $new_h * $aspect_ratio ); } if ( ! $new_h ) { $new_h = intval( $new_w / $aspect_ratio ); } $size_ratio = max( $new_w / $orig_w, $new_h / $orig_h ); $crop_w = round( $new_w / $size_ratio ); $crop_h = round( $new_h / $size_ratio ); $s_x = floor( ( $orig_w - $crop_w ) / 2 ); $s_y = floor( ( $orig_h - $crop_h ) / 2 ); return array( 0, 0, (int) $s_x, (int) $s_y, (int) $new_w, (int) $new_h, (int) $crop_w, (int) $crop_h ); } } } if(!function_exists('rev_aq_resize')){ /** * This is just a tiny wrapper function for the class above so that there is no * need to change any code in your own WP themes. Usage is still the same :) */ function rev_aq_resize($url, $width = null, $height = null, $crop = null, $single = true, $upscale = false){ /* WPML Fix */ if ( defined( 'ICL_SITEPRESS_VERSION' ) ){ global $sitepress; $url = $sitepress->convert_url( $url, $sitepress->get_default_language() ); } /* WPML Fix */ $aq_resize = Rev_Aq_Resize::getInstance(); $image = $aq_resize->process( $url, $width, $height, $crop, $single, $upscale ); return (!empty($image) || $image === false) ? $image : $url; } }