/
var
/
www
/
vhosts
/
ihelp.ro
/
httpdocs
/
src
/
View
/
Helper
/
/var/www/vhosts/ihelp.ro/httpdocs/src/View/Helper
mkdir
upload
Name
Size
Mode
Actions
CustomHelper.php
1971
0644
edit
dl
rm
FormatNumberHelper.php
950
0644
edit
dl
rm
Edit:
/var/www/vhosts/ihelp.ro/httpdocs/src/View/Helper/CustomHelper.php
(1971B)
<?php namespace App\View\Helper; use Cake\View\Helper; class CustomHelper extends Helper { public $helpers = ['Html', 'Thumb']; // imageResize Thumb public function imageResize($path = [], $size = [], $options = null) { if ($path['model_name'] == 'Profiles') { $pathImg = WWW_ROOT . UPLOAD_IMAGE . $path['model_name'] . '/' . $path['image_name']; } else { $pathImg = WWW_ROOT . UPLOAD_IMAGE . $path['model_name'] . '/' . $path['uuid'] . '/' . $path['image_name']; } if (file_exists($pathImg)) { return $this->Thumb->resize($pathImg, ['width' => $size['width'], 'height' => $size['height'], 'format' => $size['format']]); } else { return $this->Thumb->resize('no-image-icon.png', ['width' => $size['width'], 'height' => $size['height'], 'format' => $size['format']]); } } // generateUrlHdy public function generateUrlHdy($path = [], $cdn = true, $width = 640, $height = 480, $crop = false, $cropDirection = 'top') { $cdn = false; // remove HDY if ($path['model_name'] == 'Profiles') { $pathImg = UPLOAD_IMAGE . $path['model_name'] . '/' . $path['image_name']; } else { $pathImg = UPLOAD_IMAGE . $path['model_name'] . '/' . $path['uuid'] . '/' . $path['image_name']; } if ($crop == true) { //$crop = '&crop=top'; $crop = '&crop=focalpoint'; $fit = 'crop'; } else { $fit = 'fill'; $crop = ''; } if ($cdn) { return 'https://' . HDY_DOMAIN . '.hdy.ro/' . $pathImg . '?fm=webp&auto=compress&fit=' . $fit . '&fill=solid&fill-color=FFFFFF&w=' . $width . '&h=' . $height . '' . $crop; } else { if (!is_file(WWW_ROOT . 'img' . DS . $pathImg)) { $pathImg = UPLOAD_IMAGE_DEFAULT; } return $pathImg; } } }
Save
cmd:
run