Closed MoriorInvictus closed 1 year ago
also i updated file modPhpThumb from current repository, since in some issue have similar error, but they fixies doesn't fix mine
@MoriorInvictus this might be related to issue #16339. Can you try if this works for you? https://github.com/modxcms/revolution/issues/16339#issuecomment-1365508401
No, i trying use phpThumb in plugin. And if i turn this plugin off, everything is work, how to use phpThumb in modx3 in plugin?
<?php
// set handler to OnFileManagerUpload
$fullPath = $source->getBases() ['pathAbsolute'] . $directory;
foreach ($files as $file)
{
if (strripos($file['type'], 'image') === false || $file['type'] == 'image/svg+xml')
{
return;
}
$name = $file['name'];
$pathToImage = $fullPath . $name;
if (exif_imagetype($pathToImage) == IMAGETYPE_JPEG)
{
$params = array(
'w' => 1920,
'f' => 'jpeg',
'q' => 90,
);
}
elseif (exif_imagetype($pathToImage) == IMAGETYPE_PNG)
{
$params = array(
'w' => 1920,
'f' => 'png',
'q' => 90,
);
}
elseif (exif_imagetype($pathToImage) == IMAGETYPE_GIF)
{
return;
}
$phpThumb = $modx->getService('modphpthumb', 'modPhpThumb', MODX_CORE_PATH . 'src/Revolution/modPhpThumb.php', array());
$phpThumb->setSourceFilename($pathToImage);
foreach ($params as $k => $v)
{
$phpThumb->setParameter($k, $v);
}
if ($phpThumb->GenerateThumbnail())
{
if (!$phpThumb->renderToFile($pathToImage))
{
$modx->log(1, 'Error while uploading image [' . $pathToImage . ']');
}
}
else
{
$modx->log(1, print_r($phpThumb->debugmessages, 1));
}
}
@MoriorInvictus If you change the following line $phpThumb = $modx->getService('modphpthumb', 'modPhpThumb', MODX_CORE_PATH . 'src/Revolution/modPhpThumb.php', array());
into:
if (!$modx->services->has('phpthumb')) {
$modx->services->add('phpthumb', new \MODX\Revolution\modPhpThumb($modx));
}
$phpThumb = $modx->services->get('phpthumb');
does that work?
Thank you very much, you are magician, is there have instruction how to work with it? by your self, for example if i wanna transfer some plugins into new version?
When i updated, i used fastUploadTv packets, when try to load, it doesn't work, shows me this
When i tried default tv image, and make same, i upload image via file manager, and i get the error, the same, when i realod, image is uploaded, but when i try to show her on page, it just doesn't show up.
I Tried php from 7.4.13 to 8.1.14 Also i using fenom from pdoTools.
Tried with this system settings _phpthumb_allow_src_abovedocroot but result the same.
Also i updated from 2.8.4 to 3.0.0 then to 3.0.3