public function uploadfile() { $this->flushAsXml('uploadfile'); $this->setupCwd(); $quota_byte = getBytesFromString(mainConfiguration::getInstance()->get('system', 'quota-files-and-images')); if ($quota_byte != 0) { $all_size = getBusyDiskSize(array('/files', '/images')); if ($all_size >= $quota_byte) { return array('attribute:folder' => substr($this->cwd, strlen(CURRENT_WORKING_DIR)), 'attribute:upload' => 'error', 'nodes:error' => array('Ошибка: превышено ограничение на размер дискового пространства')); } } if (is_demo()) { return array('attribute:folder' => substr($this->cwd, strlen(CURRENT_WORKING_DIR)), 'attribute:upload' => 'done'); } if (isset($_FILES['Filedata']['name'])) { foreach ($_FILES['Filedata'] as $k => $v) { $_FILES['Filedata'][$k] = array('upload' => $v); } $file = umiFile::upload('Filedata', 'upload', $this->cwd); } elseif (isset($_REQUEST['filename'])) { $file = umiFile::upload(false, false, $this->cwd); } $cwd = substr($this->cwd, strlen(CURRENT_WORKING_DIR)); $result = array('attribute:folder' => $cwd, 'attribute:upload' => 'done'); if ($file) { $item = $this->cwd . "/" . $file->getFileName(); // Collect some file info $imageExt = array("jpg", "jpeg", "gif", "png"); $sizeMeasure = array("b", "Kb", "Mb", "Gb", "Tb"); $name = $file->getFileName(); $type = strtolower($file->getExt()); $ts = $file->getModifyTime(); $time = date('g:i, d.m.Y', $ts); $size = $file->getSize(); $path = $file->getFilePath(true); if (isset($_REQUEST['imagesOnly']) && !in_array($type, $imageExt)) { unlink($item); return $result; } $file = array('attribute:name' => $name, 'attribute:type' => $type, 'attribute:size' => $size, 'attribute:ctime' => $time, 'attribute:timestamp' => $ts, 'attribute:path' => $path); $i = 0; while ($size > 1024.0) { $size /= 1024; $i++; } $convertedSize = (int) round($size); if ($convertedSize == 1 && (int) floor($size) != $convertedSize) { $i++; } $file['attribute:converted-size'] = $convertedSize . $sizeMeasure[$i]; if (in_array($type, $imageExt)) { if ($info = @getimagesize($item)) { umiImageFile::addWatermark("." . $cwd . "/" . $name); $file['attribute:mime'] = $info['mime']; $file['attribute:width'] = $info[0]; $file['attribute:height'] = $info[1]; } else { unlink($item); return $result; } } else { //$file['attribute:mime'] = mime_content_type($item); } $result["file"] = $file; } return $result; }
function callbackPostExtract($v50cd20d6ab1f950f5f7cd9594d824078, &$v346210869c15b12ae6d906bb9e095aac) { $vcaf9b6b99962bf5c2264824231d7a40c = getPathInfo($v346210869c15b12ae6d906bb9e095aac['stored_filename']); $v566bbee0f961ad71b54c3c2fd36db053 = strtolower($vcaf9b6b99962bf5c2264824231d7a40c['extension']); $v435ed7e9f07f740abf511a62c00eef6e = $v346210869c15b12ae6d906bb9e095aac['filename']; if (!umiFile::isAllowedImageType($v566bbee0f961ad71b54c3c2fd36db053)) { unlink($v435ed7e9f07f740abf511a62c00eef6e); } else { $v3f6abb5601f05f03e3fdf4dec2668666 = @getimagesize($v435ed7e9f07f740abf511a62c00eef6e); if (!is_array($v3f6abb5601f05f03e3fdf4dec2668666)) { @unlink($v435ed7e9f07f740abf511a62c00eef6e); } if (umiFile::getAddWaterMark()) { if (umiImageFile::addWatermark($v435ed7e9f07f740abf511a62c00eef6e) !== false) { return 1; } } $vf9a3266ad8c9b1c7135d1e0d787fe91b = (bool) mainConfiguration::getInstance()->get("kernel", "jpg-through-gd"); if ($vf9a3266ad8c9b1c7135d1e0d787fe91b) { if ($v566bbee0f961ad71b54c3c2fd36db053 == 'jpg' || $v566bbee0f961ad71b54c3c2fd36db053 == 'jpeg') { $v9b207167e5381c47682c6b4f58a623fb = imagecreatefromjpeg($v435ed7e9f07f740abf511a62c00eef6e); if ($v9b207167e5381c47682c6b4f58a623fb) { imagejpeg($v9b207167e5381c47682c6b4f58a623fb, $v435ed7e9f07f740abf511a62c00eef6e, 100); imagedestroy($v9b207167e5381c47682c6b4f58a623fb); } } } } return 1; }
function makeThumbnailFull($vd6fe1d0be6347b8ef2427fa629c04485, $vf09cbf63485d929911164e808f84423b, $veaae26a6fb20ed3ef54fb23bfa0b1fcc, $vb435e227d5dd201e1768b2bcb2e0aa81, $va634e7960e04b1633c103382004fe526 = true, $v70c8b4c146f72fc2a6a1886dae113831 = 5, $vb5db1323df6de62d5bda823c63ad4cbe = false, $vd66636b253cb346dbb6240e30def3618 = 80) { $vf711798e436a77f680a1070c008a2a66 = true; $v78805a221a988e79ef3f42d7c5bfd418 = new umiImageFile($vd6fe1d0be6347b8ef2427fa629c04485); $v3090ad88ff7c9ca191579b709069fe64 = $v78805a221a988e79ef3f42d7c5bfd418->getFileName(); $veb9f74e698fbb6e2897b3791bc406cbf = strtolower($v78805a221a988e79ef3f42d7c5bfd418->getExt()); $veb9f74e698fbb6e2897b3791bc406cbf = $veb9f74e698fbb6e2897b3791bc406cbf == 'bmp' ? 'jpg' : $veb9f74e698fbb6e2897b3791bc406cbf; $v107703932395f334896434b598ccdc55 = array('gif', 'jpeg', 'jpg', 'png', 'bmp'); if (!in_array($veb9f74e698fbb6e2897b3791bc406cbf, $v107703932395f334896434b598ccdc55)) { return ""; } $v3090ad88ff7c9ca191579b709069fe64 = substr($v3090ad88ff7c9ca191579b709069fe64, 0, strlen($v3090ad88ff7c9ca191579b709069fe64) - (strlen($veb9f74e698fbb6e2897b3791bc406cbf) + 1)); $vb43c766cbc1365dca0ffcee38e46b613 = sha1($v78805a221a988e79ef3f42d7c5bfd418->getDirName()); if (!is_dir($vf09cbf63485d929911164e808f84423b . $vb43c766cbc1365dca0ffcee38e46b613)) { mkdir($vf09cbf63485d929911164e808f84423b . $vb43c766cbc1365dca0ffcee38e46b613, 0755, true); } $vddc9a97c07cfa1f9fe744dbc63143e5c = $v3090ad88ff7c9ca191579b709069fe64 . '_' . $veaae26a6fb20ed3ef54fb23bfa0b1fcc . '_' . $vb435e227d5dd201e1768b2bcb2e0aa81 . '_' . $v70c8b4c146f72fc2a6a1886dae113831 . '_' . $vd66636b253cb346dbb6240e30def3618 . "." . $veb9f74e698fbb6e2897b3791bc406cbf; $vf38211e4c6839893265bcda112b63f80 = $vf09cbf63485d929911164e808f84423b . $vb43c766cbc1365dca0ffcee38e46b613 . '/' . $vddc9a97c07cfa1f9fe744dbc63143e5c; if (!file_exists($vf38211e4c6839893265bcda112b63f80) || filemtime($vf38211e4c6839893265bcda112b63f80) < filemtime($vd6fe1d0be6347b8ef2427fa629c04485)) { if (file_exists($vf38211e4c6839893265bcda112b63f80)) { unlink($vf38211e4c6839893265bcda112b63f80); } $v3a8d65a128a22de38fe374a76974161c = $v78805a221a988e79ef3f42d7c5bfd418->getWidth(); $v427c23061461a4b29c5d39dd32b7f2c6 = $v78805a221a988e79ef3f42d7c5bfd418->getHeight(); if (!($v3a8d65a128a22de38fe374a76974161c && $v427c23061461a4b29c5d39dd32b7f2c6)) { throw new coreException(getLabel('error-image-corrupted', null, $vd6fe1d0be6347b8ef2427fa629c04485)); } if ($vb435e227d5dd201e1768b2bcb2e0aa81 == "auto") { $v3c10300988ff410c7f7181d43214229e = (int) round($v427c23061461a4b29c5d39dd32b7f2c6 * ($veaae26a6fb20ed3ef54fb23bfa0b1fcc / $v3a8d65a128a22de38fe374a76974161c)); $vb435e227d5dd201e1768b2bcb2e0aa81 = $v3c10300988ff410c7f7181d43214229e; $v6f81aaeb51b38cddc8851000851e9c98 = (int) $veaae26a6fb20ed3ef54fb23bfa0b1fcc; } else { if ($veaae26a6fb20ed3ef54fb23bfa0b1fcc == "auto") { $v6f81aaeb51b38cddc8851000851e9c98 = (int) round($v3a8d65a128a22de38fe374a76974161c * ($vb435e227d5dd201e1768b2bcb2e0aa81 / $v427c23061461a4b29c5d39dd32b7f2c6)); $veaae26a6fb20ed3ef54fb23bfa0b1fcc = $v6f81aaeb51b38cddc8851000851e9c98; } else { $v6f81aaeb51b38cddc8851000851e9c98 = (int) $veaae26a6fb20ed3ef54fb23bfa0b1fcc; } $v3c10300988ff410c7f7181d43214229e = (int) $vb435e227d5dd201e1768b2bcb2e0aa81; } $va13a7d0465adabf0bc59a5a26873cc4d = 0; $v6918e386f5cdd77edf37c6f42cdad6a2 = 0; if (!intval($veaae26a6fb20ed3ef54fb23bfa0b1fcc) || !intval($vb435e227d5dd201e1768b2bcb2e0aa81)) { $va634e7960e04b1633c103382004fe526 = false; } if ($va634e7960e04b1633c103382004fe526) { $v17370b9bf2bb4af83eba44b15e2315b9 = $v3a8d65a128a22de38fe374a76974161c / $veaae26a6fb20ed3ef54fb23bfa0b1fcc; $v205a8652407c62be13889d94c91f49e8 = $v427c23061461a4b29c5d39dd32b7f2c6 / $vb435e227d5dd201e1768b2bcb2e0aa81; if ($v17370b9bf2bb4af83eba44b15e2315b9 > $v205a8652407c62be13889d94c91f49e8) { $v6918e386f5cdd77edf37c6f42cdad6a2 = round(($v3a8d65a128a22de38fe374a76974161c - $veaae26a6fb20ed3ef54fb23bfa0b1fcc * $v205a8652407c62be13889d94c91f49e8) / 2); $v3a8d65a128a22de38fe374a76974161c = round($veaae26a6fb20ed3ef54fb23bfa0b1fcc * $v205a8652407c62be13889d94c91f49e8); } elseif ($v17370b9bf2bb4af83eba44b15e2315b9 < $v205a8652407c62be13889d94c91f49e8) { $va13a7d0465adabf0bc59a5a26873cc4d = round(($v427c23061461a4b29c5d39dd32b7f2c6 - $vb435e227d5dd201e1768b2bcb2e0aa81 * $v17370b9bf2bb4af83eba44b15e2315b9) / 2); $v427c23061461a4b29c5d39dd32b7f2c6 = round($vb435e227d5dd201e1768b2bcb2e0aa81 * $v17370b9bf2bb4af83eba44b15e2315b9); } if ($v70c8b4c146f72fc2a6a1886dae113831) { switch ($v70c8b4c146f72fc2a6a1886dae113831) { case 1: $v6918e386f5cdd77edf37c6f42cdad6a2 = 0; $va13a7d0465adabf0bc59a5a26873cc4d = 0; break; case 2: $va13a7d0465adabf0bc59a5a26873cc4d = 0; break; case 3: $v6918e386f5cdd77edf37c6f42cdad6a2 += $v6918e386f5cdd77edf37c6f42cdad6a2; $va13a7d0465adabf0bc59a5a26873cc4d = 0; break; case 4: $v6918e386f5cdd77edf37c6f42cdad6a2 = 0; break; case 5: break; case 6: $v6918e386f5cdd77edf37c6f42cdad6a2 += $v6918e386f5cdd77edf37c6f42cdad6a2; break; case 7: $v6918e386f5cdd77edf37c6f42cdad6a2 = 0; $va13a7d0465adabf0bc59a5a26873cc4d += $va13a7d0465adabf0bc59a5a26873cc4d; break; case 8: $va13a7d0465adabf0bc59a5a26873cc4d += $va13a7d0465adabf0bc59a5a26873cc4d; break; case 9: $v6918e386f5cdd77edf37c6f42cdad6a2 += $v6918e386f5cdd77edf37c6f42cdad6a2; $va13a7d0465adabf0bc59a5a26873cc4d += $va13a7d0465adabf0bc59a5a26873cc4d; break; } } } $vf12105146129696d6a7e0ed521db2e48 = imagecreatetruecolor($v6f81aaeb51b38cddc8851000851e9c98, $v3c10300988ff410c7f7181d43214229e); $v520584b026332b9e0b598c3d091329b1 = $v78805a221a988e79ef3f42d7c5bfd418->createImage($vd6fe1d0be6347b8ef2427fa629c04485); $v36cd38f49b9afa08222c0dc9ebfe35eb = $v520584b026332b9e0b598c3d091329b1['im']; if ($veaae26a6fb20ed3ef54fb23bfa0b1fcc * 4 < $v3a8d65a128a22de38fe374a76974161c && $vb435e227d5dd201e1768b2bcb2e0aa81 * 4 < $v427c23061461a4b29c5d39dd32b7f2c6) { $_TMP = array(); $_TMP['width'] = round($veaae26a6fb20ed3ef54fb23bfa0b1fcc * 4); $_TMP['height'] = round($vb435e227d5dd201e1768b2bcb2e0aa81 * 4); $_TMP['image'] = imagecreatetruecolor($_TMP['width'], $_TMP['height']); if ($veb9f74e698fbb6e2897b3791bc406cbf == 'gif') { $_TMP['image_white'] = imagecolorallocate($_TMP['image'], 255, 255, 255); imagefill($_TMP['image'], 0, 0, $_TMP['image_white']); imagecolortransparent($_TMP['image'], $_TMP['image_white']); imagealphablending($v36cd38f49b9afa08222c0dc9ebfe35eb, TRUE); imagealphablending($_TMP['image'], TRUE); } else { imagealphablending($_TMP['image'], false); imagesavealpha($_TMP['image'], true); } imagecopyresampled($_TMP['image'], $v36cd38f49b9afa08222c0dc9ebfe35eb, 0, 0, $v6918e386f5cdd77edf37c6f42cdad6a2, $va13a7d0465adabf0bc59a5a26873cc4d, $_TMP['width'], $_TMP['height'], $v3a8d65a128a22de38fe374a76974161c, $v427c23061461a4b29c5d39dd32b7f2c6); imageDestroy($v36cd38f49b9afa08222c0dc9ebfe35eb); $v36cd38f49b9afa08222c0dc9ebfe35eb = $_TMP['image']; $v3a8d65a128a22de38fe374a76974161c = $_TMP['width']; $v427c23061461a4b29c5d39dd32b7f2c6 = $_TMP['height']; $v6918e386f5cdd77edf37c6f42cdad6a2 = 0; $va13a7d0465adabf0bc59a5a26873cc4d = 0; unset($_TMP); } if ($veb9f74e698fbb6e2897b3791bc406cbf == 'gif') { $vde6403c41549334bb72244a31e9edf52 = imagecolorallocate($vf12105146129696d6a7e0ed521db2e48, 255, 255, 255); imagefill($vf12105146129696d6a7e0ed521db2e48, 0, 0, $vde6403c41549334bb72244a31e9edf52); imagecolortransparent($vf12105146129696d6a7e0ed521db2e48, $vde6403c41549334bb72244a31e9edf52); imagealphablending($v36cd38f49b9afa08222c0dc9ebfe35eb, TRUE); imagealphablending($vf12105146129696d6a7e0ed521db2e48, TRUE); } else { imagealphablending($vf12105146129696d6a7e0ed521db2e48, false); imagesavealpha($vf12105146129696d6a7e0ed521db2e48, true); } imagecopyresampled($vf12105146129696d6a7e0ed521db2e48, $v36cd38f49b9afa08222c0dc9ebfe35eb, 0, 0, $v6918e386f5cdd77edf37c6f42cdad6a2, $va13a7d0465adabf0bc59a5a26873cc4d, $veaae26a6fb20ed3ef54fb23bfa0b1fcc, $vb435e227d5dd201e1768b2bcb2e0aa81, $v3a8d65a128a22de38fe374a76974161c, $v427c23061461a4b29c5d39dd32b7f2c6); if ($vf711798e436a77f680a1070c008a2a66) { $vf12105146129696d6a7e0ed521db2e48 = makeThumbnailFullUnsharpMask($vf12105146129696d6a7e0ed521db2e48, 80, 0.5, 3); } switch ($veb9f74e698fbb6e2897b3791bc406cbf) { case 'gif': $v9b207167e5381c47682c6b4f58a623fb = imagegif($vf12105146129696d6a7e0ed521db2e48, $vf38211e4c6839893265bcda112b63f80); break; case 'png': $v9b207167e5381c47682c6b4f58a623fb = imagepng($vf12105146129696d6a7e0ed521db2e48, $vf38211e4c6839893265bcda112b63f80); break; default: $v9b207167e5381c47682c6b4f58a623fb = imagejpeg($vf12105146129696d6a7e0ed521db2e48, $vf38211e4c6839893265bcda112b63f80, $vd66636b253cb346dbb6240e30def3618); } if (!$v9b207167e5381c47682c6b4f58a623fb) { throw new coreException(getLabel('label-errors-16008')); } imageDestroy($v36cd38f49b9afa08222c0dc9ebfe35eb); imageDestroy($vf12105146129696d6a7e0ed521db2e48); if ($vb5db1323df6de62d5bda823c63ad4cbe) { umiImageFile::addWatermark($vf38211e4c6839893265bcda112b63f80); } } $v2063c1608d6e0baf80249c42e2be5804 = new umiImageFile($vf38211e4c6839893265bcda112b63f80); $v47c80780ab608cc046f2a6e6f071feb6 = array(); $v47c80780ab608cc046f2a6e6f071feb6['size'] = $v2063c1608d6e0baf80249c42e2be5804->getSize(); $v47c80780ab608cc046f2a6e6f071feb6['filename'] = $v2063c1608d6e0baf80249c42e2be5804->getFileName(); $v47c80780ab608cc046f2a6e6f071feb6['filepath'] = $v2063c1608d6e0baf80249c42e2be5804->getFilePath(); $v47c80780ab608cc046f2a6e6f071feb6['src'] = $v2063c1608d6e0baf80249c42e2be5804->getFilePath(true); $v47c80780ab608cc046f2a6e6f071feb6['ext'] = $v2063c1608d6e0baf80249c42e2be5804->getExt(); $v47c80780ab608cc046f2a6e6f071feb6['width'] = $v2063c1608d6e0baf80249c42e2be5804->getWidth(); $v47c80780ab608cc046f2a6e6f071feb6['height'] = $v2063c1608d6e0baf80249c42e2be5804->getHeight(); if (cmsController::getInstance()->getCurrentMode() == "admin") { $v47c80780ab608cc046f2a6e6f071feb6['src'] = str_replace("&", "&", $v47c80780ab608cc046f2a6e6f071feb6['src']); } return $v47c80780ab608cc046f2a6e6f071feb6; }
public function makeThumbImage($preFix = false, $elem_id = false, $field_name = false, $width = 'auto', $height = 'auto', $crop = true, $cropside = 5, $isLogo = false, $quality = 100, $foldersSave = false) { $arr = array(); if (!$foldersSave) { $foldersSave = "images/thumbs"; } if ($elem_id) { $element = umiHierarchy::getInstance()->getElement($elem_id); if ($element instanceof umiHierarchyElement) { if ($field_name) { } else { $arr['error'] = '<![CDATA[ Укажите название поля, в котором содержится изображение($field_name) ]]>'; return $arr; } $image_elem = $element->getValue($field_name); $newFileName = $preFix . $elem_id . '_' . $field_name; if (is_object($image_elem)) { $path = $image_elem->getFilepath(); } } } else { $arr['error'] = '<![CDATA[ Не задан идентификатор объекта($elem_id) ]]>'; return $arr; } $domain = getServer('HTTP_HOST'); $thumbs_path = './' . $foldersSave . '/'; $isSharpen = true; $image = new umiImageFile($path); $file_name = $image->getFileName(); $file_ext = strtolower($image->getExt()); $file_ext = $file_ext == 'bmp' ? 'jpg' : $file_ext; $allowedExts = array('gif', 'jpeg', 'jpg', 'png', 'bmp'); if (!in_array($file_ext, $allowedExts)) { $arr['error'] = '<![CDATA[ Не разрешенное расширение файла ]]>'; return $arr; } /*Название папки в виде ширина_высота_вырезание_качество*/ $thumbPath = $width . '_' . $height . '_' . $cropside . '_' . $quality; /*Определяет, является ли имя файла директорией*/ if (!is_dir($thumbs_path . $thumbPath)) { mkdir($thumbs_path . $thumbPath, 0755, true); } /*Название уменьшенного изображения*/ $file_name_new = $newFileName . "." . $file_ext; $path_new = $thumbs_path . $thumbPath . '/' . $file_name_new; if (!file_exists($path_new) || filemtime($path_new) < filemtime($path)) { if (file_exists($path_new)) { unlink($path_new); } $width_src = $image->getWidth(); $height_src = $image->getHeight(); if (!($width_src && $height_src)) { throw new coreException(getLabel('error-image-corrupted', null, $path)); } if ($height == "auto") { $real_height = (int) round($height_src * ($width / $width_src)); $height = $real_height; $real_width = (int) $width; } else { if ($width == "auto") { $real_width = (int) round($width_src * ($height / $height_src)); $width = $real_width; } else { $real_width = (int) $width; } $real_height = (int) $height; } $offset_h = 0; $offset_w = 0; /*realloc: devision by zero fix*/ if (!intval($width) || !intval($height)) { $crop = false; } if ($crop) { $width_ratio = $width_src / $width; $height_ratio = $height_src / $height; if ($width_ratio > $height_ratio) { $offset_w = round(($width_src - $width * $height_ratio) / 2); $width_src = round($width * $height_ratio); } elseif ($width_ratio < $height_ratio) { $offset_h = round(($height_src - $height * $width_ratio) / 2); $height_src = round($height * $width_ratio); } if ($cropside) { switch ($cropside) { case 1: $offset_w = 0; $offset_h = 0; break; case 2: $offset_h = 0; break; case 3: $offset_w += $offset_w; $offset_h = 0; break; case 4: $offset_w = 0; break; case 5: break; case 6: $offset_w += $offset_w; break; case 7: $offset_w = 0; $offset_h += $offset_h; break; case 8: $offset_h += $offset_h; break; case 9: $offset_w += $offset_w; $offset_h += $offset_h; break; } } } $thumb = imagecreatetruecolor($real_width, $real_height); $source_array = $image->createImage($path); $source = $source_array['im']; if ($width * 4 < $width_src && $height * 4 < $height_src) { $_TMP = array(); $_TMP['width'] = round($width * 4); $_TMP['height'] = round($height * 4); $_TMP['image'] = imagecreatetruecolor($_TMP['width'], $_TMP['height']); if ($file_ext == 'gif') { $_TMP['image_white'] = imagecolorallocate($_TMP['image'], 255, 255, 255); imagefill($_TMP['image'], 0, 0, $_TMP['image_white']); imagecolortransparent($_TMP['image'], $_TMP['image_white']); imagealphablending($source, TRUE); imagealphablending($_TMP['image'], TRUE); } else { imagealphablending($_TMP['image'], false); imagesavealpha($_TMP['image'], true); } imagecopyresampled($_TMP['image'], $source, 0, 0, $offset_w, $offset_h, $_TMP['width'], $_TMP['height'], $width_src, $height_src); imageDestroy($source); $source = $_TMP['image']; $width_src = $_TMP['width']; $height_src = $_TMP['height']; $offset_w = 0; $offset_h = 0; unset($_TMP); } if ($file_ext == 'gif') { $thumb_white_color = imagecolorallocate($thumb, 255, 255, 255); imagefill($thumb, 0, 0, $thumb_white_color); imagecolortransparent($thumb, $thumb_white_color); imagealphablending($source, TRUE); imagealphablending($thumb, TRUE); } else { imagealphablending($thumb, false); imagesavealpha($thumb, true); } imagecopyresampled($thumb, $source, 0, 0, $offset_w, $offset_h, $width, $height, $width_src, $height_src); if ($isSharpen) { $thumb = makeThumbnailFullUnsharpMask($thumb, 80, 0.5, 3); } switch ($file_ext) { case 'gif': $res = imagegif($thumb, $path_new); break; case 'png': $res = imagepng($thumb, $path_new); break; default: $res = imagejpeg($thumb, $path_new, $quality); } if (!$res) { throw new coreException(getLabel('label-errors-16008')); } imageDestroy($source); imageDestroy($thumb); if ($isLogo) { umiImageFile::addWatermark($path_new); } } /*Создание нового уменьшенного изображения на поддомене*/ $value = new umiImageFile($path_new); $arr['info']['nodes:elem_id'][] = $elem_id; $arr['info']['nodes:field_name'][] = $field_name; $arr['info']['nodes:path'][] = $path; $arr['info']['nodes:alt_name'][] = $alt_name; $arr['info']['nodes:width'][] = $width; $arr['info']['nodes:height'][] = $height; $arr['info']['nodes:crop'][] = $crop; $arr['info']['nodes:cropside'][] = $cropside; $arr['info']['nodes:isLogo'][] = $isLogo; $arr['info']['nodes:quality'][] = $quality; $arr['info']['nodes:domain'][] = $domain; $arr['thumb_info']['nodes:width'][] = $value->getWidth(); $arr['thumb_info']['nodes:height'][] = $value->getHeight(); $arr['thumb_info']['nodes:size'][] = $value->getSize(); $arr['thumb_info']['nodes:ext'][] = $value->getExt(); $arr['thumb_info']['nodes:filename'][] = $value->getFileName(); $arr['thumb_info']['nodes:filepath'][] = $value->getFilePath(); $thumb_src = 'http://' . $domain . '/' . $foldersSave . substr($value->getFilePath(true), iconv_strlen($foldersSave) + 1); $arr['thumb_info']['nodes:src'][] = $thumb_src; if (cmsController::getInstance()->getCurrentMode() == "admin") { $arr['src'] = str_replace("&", "&", $arr['src']); } return $arr; }