/** * @deprecated 1.5.0 */ function imageCut($srcFile, $destFile, $destWidth = NULL, $destHeight = NULL, $fileType = 'jpg', $destX = 0, $destY = 0) { Tools::displayAsDeprecated(); if (isset($srcFile['tmp_name'])) { return ImageManager::cut($srcFile['tmp_name'], $destFile, $destWidth, $destHeight, $fileType, $destX, $destY); } return false; }
} public static function import_media_img($file_url, $folder, $filename) { // $folder = rev_media_folder(); $wpdb = rev_db_class::rev_db_instance(); copy($file_url, $folder . $filename); $imagearray = array('file_name' => $filename); $mysqli = $wpdb->insert($wpdb->prefix . GlobalsRevSlider::TABLE_ATTACHMENT_IMAGES, $imagearray); $imgid = $wpdb->Insert_ID(); if (!empty($mysqli) && is_numeric($imgid)) { //new fixing $sizes = array(GlobalsRevSlider::IMAGE_SIZE_THUMBNAIL, GlobalsRevSlider::IMAGE_SIZE_MEDIUM, GlobalsRevSlider::IMAGE_SIZE_LARGE); $filerealname = substr($filename, 0, strrpos($filename, '.')); $fileext = substr($filename, strrpos($filename, '.'), strlen($filename) - strlen($filerealname)); list($width, $height) = getimagesize($folder . $filename); $count = 0; foreach ($sizes as $size) { $nsize = self::get_img_aspect_ratio(array($width, $height, $size)); $newfilename = "{$filerealname}-{$size}x{$size}{$fileext}"; if (++$count > 1) { ImageManager::resize($folder . $filename, $folder . $newfilename, $nsize[0], $nsize[1]); } else { $posx = $width / 2 - $size / 2; $posy = $height / 2 - $size / 2; ImageManager::cut($folder . $filename, $folder . $newfilename, $size, $size, substr($fileext, 1), $posx, $posy); } } return array("id" => $imgid, "path" => 'uploads/' . $filename); // return array("id" => $imgid, "path" => $filename); }