JoomGalleryfriends / JG4-dev

Development repository for JoomGallery v4.x
GNU General Public License v3.0
10 stars 7 forks source link

ImageMagick did not work on Joomla 5.0.3 - PHP 8.1.13 #198

Closed AlexanderSupp closed 6 months ago

AlexanderSupp commented 7 months ago

Imagetype: thumbnail Used image processor: ImageMagick 7.1.0-51 Q16-HDRI x64 aea87b5:20221016 https://imagemagick.org Resizing to height... Auto-Orient image ... File not existing. File not existing. ERROR: Server problem. The following statement could not be executed in the php code: 'exec(magick convert -auto-orient -strip -resize "250x250" -quality "80" -unsharp "3.5x1.2+1.0+0.10" "C:\wamp64\tmp\2022-02-23 23-00-07 - Signet_Fotofreunde-1181-1181.jpg" "C:\wamp64\www\FotofreundeMuchO20240207\C:\wamp64\www\FotofreundeMuchO20240207\tmp\tmp_img_2999.jpg");' Errors detected in processed image. Abort further processing. Image-File (2022-02-23-23-00-07-signet-fotofreunde-1181-1181_20240225_1211441727.jpg) of type 'thumbnail' could not be created.

GD lib works

MrMusic commented 7 months ago

Used image processor: ImageMagick 7.1.0-51 Q16-HDRI x64 aea87b5:20221016 https://imagemagick.org/

Hm, I can't reproduce the problem for myself, but I only have IM 7.0.7 available. Do you use latest main Branch?

DE: Hm, ich kann das Problem bei mir nicht reproduzieren, habe aber nur IM 7.0.7 zur Verfügung. Verwendest du den aktuellen Main-Branch? PHP 8.1 Joomla 5.0.3 ImageMagick 7.0.7-11

AlexanderSupp commented 7 months ago

Verwendest du den aktuellen Main-Branch? Yes it's the actual main branch.

AlexanderSupp commented 7 months ago

On the same WampServer it works in 3.10.12

AlexanderSupp commented 7 months ago

I tested again this problem. Joomla 4.4.3 same as Joomla 5.0.3. Tested with "JG4-dev-migraten-dbfix.zip". Interesting is that the last parameter of the following command is wrong. The directories-path are twice.

'exec(magick convert -auto-orient -strip -resize "444x250" -quality "80" -unsharp "3.5x1.2+1.0+0.10" "C:\wamp64\www\FotofreundeNeu\tmp\AS-SAM_9329.JPG" "C:\wamp64\www\FotofreundeNeu\C:\wamp64\www\FotofreundeNeu\tmp\tmp_img_2869.jpg");'

Screenshot 2024-03-03 115545

AlexanderSupp commented 7 months ago

Fully debug html as txt here: Images Upload Images - Fotofreunde Much - Administration.txt

MrMusic commented 6 months ago

Which tmp path did you enter in the Joomla configuration? Is it a path above the Joomla ROOT directory? Then this problem may occur. Try a path within the Joomla ROOT directory.

Alternatively, comment out the line 292 of the file administrator/com_joomgallery/src/Service/IMGtools/IMtools.php by entering two slashes at the beginning: // $file = JPATH_ROOT . '/' . $file;

DE: Welchen tmp Pfad hast du in der Joomla Konfiguration eingetragen? Ist es ein Pfad oberhalb des Joomla ROOT Verzeichnisses? Dann kann dieses Problem auftreten. Versuche es mal mit einem Pfad innerhalb des Joomla ROOT Verzeichnisses.

Alternativ kommentiere die Zeile 292 der Datei administrator/com_joomgallery/src/Service/IMGtools/IMtools.php aus, indem du am Anfang zwei Schrägstriche eingibst: // $file = JPATH_ROOT . '/' . $file;

AlexanderSupp commented 6 months ago

Thanks for your excellent service. The temp path was fine. The reason was the misplaced slash. So I changed IMtools.php as you recommended as follows: Screenshot 2024-03-11 115601 Thanks again. I spent a lot of time here with my unqualified troubleshooting. Will this be fixed in the next versions?

MrMusic commented 6 months ago

The temp path was fine. The reason was the misplaced slash.

I don't understand. What exactly was the tmp path?

AlexanderSupp commented 6 months ago

Which tmp path did you enter in the Joomla configuration? Is it a path above the Joomla ROOT directory? Then this problem may occur. Try a path within the Joomla ROOT directory.

The path is within the Joomla ROOT directory. And so the path was fine.

Screenshot 2024-03-11 164628

So I comment out the line 292 and everything works fine.

MrMusic commented 6 months ago

As far as I have now found out, there are two possible sources of error:

  1. The upper/lower case of the folder does not match the notation in the Joomla configuration
  2. The path for the tmp folder in the Joomla configuration is outside the Joomla ROOT directory

The first problem could be solved by using stripos instead of strpos in line 290. But I can't answer whether this part of the code is necessary at all. @Elfangor93 can you take a look at this?

AlexanderSupp commented 6 months ago

2. The path for the tmp folder in the Joomla configuration is outside the Joomla ROOT directory

???

The path is within the Joomla ROOT directory. And so the path was fine.

From my point of view, the active line 292 of IMtools.php is wrong. The path definition in the tab server is correct. But I'm not sure if I understand this situation.

MrMusic commented 6 months ago
  1. The path for the tmp folder in the Joomla configuration is outside the Joomla ROOT directory ???

During my tests, I discovered that these two points can cause the error. That is why I have tried to give a "general" description of these points and therefore has nothing to do with your specific example. You have pointed out the problem with your report - thank you very much for that!

From my point of view, the active line 292 of IMtools.php is wrong.

I can't say what the final solution is, that's why I pinged @Elfangor93

AlexanderSupp commented 6 months ago

This issue is also solved, and the solution was successfully tested. So I close it now.