representative not generated when '.heic' photos uploaded from Piwigo iOS #2149

Closed
opened 2026-10-05 01:07:55 +02:00 by adam · 1 comment
Owner

It happens after piwigo upgrading to 16.0.
I found the logs below:

[2025-11-28 23:47:01][exec=62Qi7SW3NF] [INFO] upload_file_heic, exec = /usr/local/bin/magick -sampling-factor 4:2:0 -quality 85 -interlace JPEG -colorspace sRGB -auto-orient +repage -resize "2484x1863>" "/nas/Photo/upload/2025/11/28/20251128234701-b8210af6.heic" "././upload/2025/11/28/pwg_representative/20251128234701-b8210af6.jpg" 2>&1
[2025-11-28 23:47:01][exec=62Qi7SW3NF] [INFO] upload_file_tiff, $file_path = ././upload/2025/11/28/20251128234701-b8210af6.heic, $representative_ext =
[2025-11-28 23:47:01][exec=62Qi7SW3NF] [INFO] upload_file_video, $file_path = ././upload/2025/11/28/20251128234701-b8210af6.heic, $representative_ext =
[2025-11-28 23:47:01][exec=62Qi7SW3NF] [INFO] upload_file_psd, $file_path = ././upload/2025/11/28/20251128234701-b8210af6.heic, $representative_ext =
[2025-11-28 23:47:01][exec=62Qi7SW3NF] [INFO] upload_file_eps, $file_path = ././upload/2025/11/28/20251128234701-b8210af6.heic, $representative_ext =
[2025-11-28 23:47:01][exec=62Qi7SW3NF] [INFO] Handling ././upload/2025/11/28/20251128234701-b8210af6.heic got
[2025-11-28 23:47:01][exec=62Qi7SW3NF] [INFO] add_uploaded_file : force cache generation, derivative_url = https://pic./i/themes/default/icon/mimetypes/unknown-me.png

and i tried running magick cmd in terminal, It outputs:
magick: no images found for operation `-auto-orient' at CLI arg 9 @ error/operation.c/CLIOption/5481.

This is caused by the difference in parameter parsing between ImageMagick 7's magick CLI and the older convert CLI.
The error message indicates that when parsing -auto-orient, there was no valid input image before it.
In the new version of Piwigo, the command called has -auto-orient appearing before the input file parameter, causing magick to report an error.
The older convert tolerated this order, so it executed normally.

piwigo/admin/include/functions_upload.inc.php should modified as:

 642   $exec = $conf['ext_imagick_dir'].pwg_image::get_ext_imagick_command();
 643   $exec.= ' "'.realpath($file_path).'"';
 644   $exec.= ' -sampling-factor 4:2:0 -quality 85 -interlace JPEG -colorspace sRGB -auto-orient +repage -resize      "'.$w.'x'.$h.'>"';
 645   $exec.= ' "'.$representative_file_path.'"';
 646   $exec.= ' 2>&1';
It happens after piwigo upgrading to 16.0. I found the logs below: > [2025-11-28 23:47:01][exec=62Qi7SW3NF] [INFO] upload_file_heic, exec = /usr/local/bin/magick -sampling-factor 4:2:0 -quality 85 -interlace JPEG -colorspace sRGB -auto-orient +repage -resize "2484x1863>" "/nas/Photo/upload/2025/11/28/20251128234701-b8210af6.heic" "././upload/2025/11/28/pwg_representative/20251128234701-b8210af6.jpg" 2>&1 > [2025-11-28 23:47:01][exec=62Qi7SW3NF] [INFO] upload_file_tiff, $file_path = ././upload/2025/11/28/20251128234701-b8210af6.heic, $representative_ext = > [2025-11-28 23:47:01][exec=62Qi7SW3NF] [INFO] upload_file_video, $file_path = ././upload/2025/11/28/20251128234701-b8210af6.heic, $representative_ext = > [2025-11-28 23:47:01][exec=62Qi7SW3NF] [INFO] upload_file_psd, $file_path = ././upload/2025/11/28/20251128234701-b8210af6.heic, $representative_ext = > [2025-11-28 23:47:01][exec=62Qi7SW3NF] [INFO] upload_file_eps, $file_path = ././upload/2025/11/28/20251128234701-b8210af6.heic, $representative_ext = > [2025-11-28 23:47:01][exec=62Qi7SW3NF] [INFO] Handling ././upload/2025/11/28/20251128234701-b8210af6.heic got > [2025-11-28 23:47:01][exec=62Qi7SW3NF] [INFO] add_uploaded_file : force cache generation, derivative_url = https://pic./i/themes/default/icon/mimetypes/unknown-me.png and i tried running magick cmd in terminal, It outputs: ```magick: no images found for operation `-auto-orient' at CLI arg 9 @ error/operation.c/CLIOption/5481.``` This is caused by the difference in parameter parsing between ImageMagick 7's magick CLI and the older convert CLI. The error message indicates that when parsing -auto-orient, there was no valid input image before it. In the new version of Piwigo, the command called has -auto-orient appearing before the input file parameter, causing magick to report an error. The older convert tolerated this order, so it executed normally. piwigo/admin/include/functions_upload.inc.php should modified as: ``` 642 $exec = $conf['ext_imagick_dir'].pwg_image::get_ext_imagick_command(); 643 $exec.= ' "'.realpath($file_path).'"'; 644 $exec.= ' -sampling-factor 4:2:0 -quality 85 -interlace JPEG -colorspace sRGB -auto-orient +repage -resize "'.$w.'x'.$h.'>"'; 645 $exec.= ' "'.$representative_file_path.'"'; 646 $exec.= ' 2>&1'; ``` <!-- github-sync-id:3693936419 -->
adam closed this issue 2026-10-05 01:07:55 +02:00
Author
Owner

related to #2487

related to #2487 <!-- github-comment-id:3687503629 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#2149