Skip to content
Snippets Groups Projects
Commit a5951e6e authored by Kevin Ditscheid's avatar Kevin Ditscheid
Browse files

[BUGFIX] Replace PATH_site with Environment::getPublicPath()

parent c7cf77a1
No related branches found
No related tags found
1 merge request!25Feature upgrade to typo3 10
......@@ -27,6 +27,7 @@ namespace SGalinski\SgNews\Service;
***************************************************************/
use TYPO3\CMS\Core\Charset\CharsetConverter;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Domain\Model\FileReference;
......@@ -77,16 +78,16 @@ class ImageService implements SingletonInterface {
$fileName .= $originalResource->getNameWithoutExtension();
$croppedImage = $path . $prefix . sha1($fileName) . '.' . $extension;
$originalImage = PATH_site . rawurldecode($originalResource->getPublicUrl());
if ($originalImage !== '' && $croppedImage !== '' && !is_file(PATH_site . $croppedImage)) {
GeneralUtility::mkdir_deep(PATH_site . $path);
$originalImage = Environment::getPublicPath() . '/' . rawurldecode($originalResource->getPublicUrl());
if ($originalImage !== '' && $croppedImage !== '' && !is_file(Environment::getPublicPath() . '/' . $croppedImage)) {
GeneralUtility::mkdir_deep(Environment::getPublicPath() . '/' . $path);
$imagick = new \Imagick($originalImage);
$imagick->cropImage($coordinates['w'], $coordinates['h'], $coordinates['x1'], $coordinates['y1']);
$imagick->writeImage(PATH_site . $croppedImage);
if (!is_file(PATH_site . $croppedImage)) {
$imagick->writeImage(Environment::getPublicPath() . '/' . $croppedImage);
if (!is_file(Environment::getPublicPath() . '/' . $croppedImage)) {
$croppedImage = '';
} else {
GeneralUtility::fixPermissions(PATH_site . $croppedImage);
GeneralUtility::fixPermissions(Environment::getPublicPath() . '/' . $croppedImage);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment