Ticket #348 (closed defect: fixed)

Opened 5 years ago

Last modified 5 years ago

Thumbnail generating error when files names are UTF-8

Reported by: chris Owned by: chris
Priority: minor Milestone: Phase 5
Component: Drupal modules & settings Keywords:
Cc: jim Estimated Number of Hours: 0.0
Add Hours to Ticket: 0 Billable?: yes
Total Hours: 1.7

Description

Saw this in the dblog report:

User error: ImageMagick reported error code 1. Message: convert: unable to open image `sites/default/files/images/PS_DSC2064 HP Joo do Gro.jpg': gick-6.6.0/modules-Q16/coders/jpeg.la @ error/blob.c/OpenBlob/2489. convert: unable to open image `sites/default/files/images/PS_DSC2064 HP Joo do Gro.jpg': @ error/blob.c/OpenBlob/2489. convert: missing an image filename `sites/default/files/imagecache/thumb-small/images/PS_DSC2064 HP Joo do Gro.jpg' @ error/convert.c/ConvertImageCommand/2940. in _imageapi_imagemagick_convert_exec() (line 235 of /web/transitionnetwork.org/www/sites/all/modules/imageapi/imageapi_imagemagick.module).

See https://www.transitionnetwork.org/admin/reports/event/6469093

The file in question is /web/transitionnetwork.org/www/sites/default/files/images/PS_DSC2064 HP João do Grão.jpg and there appears to be a problem passing the ã to ImageMagick?.

Change History

comment:1 Changed 5 years ago by chris

  • Add Hours to Ticket changed from 0.0 to 0.2
  • Owner changed from jim to chris
  • Status changed from new to accepted
  • Total Hours changed from 0.0 to 0.2

Another example of this:

User error: ImageMagick reported error code 1. Message: convert: unable to open image `sites/default/files/workspace/logos/Mdaillon IO en transition 290x152.png': gick-6.6.0/modules-Q16/coders/png.la @ error/blob.c/OpenBlob/2489. convert: unable to open image `sites/default/files/workspace/logos/Mdaillon IO en transition 290x152.png': @ error/blob.c/OpenBlob/2489. convert: unable to open file `sites/default/files/workspace/logos/Mdaillon IO en transition 290x152.png' @ error/png.c/ReadPNGImage/2951. convert: missing an image filename `sites/default/files/imagecache/thumb-medium/workspace/logos/Mdaillon IO en transition 290x152.png' @ error/convert.c/ConvertImageCommand/2940. in _imageapi_imagemagick_convert_exec() (line 235 of /web/transitionnetwork.org/www/sites/all/modules/imageapi/imageapi_imagemagick.module).

https://www.transitionnetwork.org/admin/reports/event/6472204

File: /web/transitionnetwork.org/www/sites/default/files/workspace/logos/Médaillon IO en transition 290x152.png

What is needed is for file names to be turned into US ASCII before the thumbnails are generated from them, or perhaps imagemagick can be made to work with UTF8 filenames?

Or perhaps I can fix it at a server level, see http://drupal.org/node/352262 I'll test this on the dev server and if it works apply it to the live server.

comment:2 Changed 5 years ago by jim

Or, provided you can install the high quality version (not usually in the repository for Debian without adding another source) we can switch to the GD library?

comment:3 Changed 5 years ago by chris

  • Add Hours to Ticket changed from 0.0 to 1.5
  • Status changed from accepted to closed
  • Resolution set to fixed
  • Total Hours changed from 0.2 to 1.7

The suggestion of setting LANG in /etc/init.d/apache2 didn't work, it was still C, but setting it in /etc/apache2/envvars does work, see https://kiwi.transitionnetwork.org/info/

However this didn't fix the problem.

What did was editing sites/all/modules/imageapi/imageapi_imagemagick.module and adding a new line 153:

  setlocale(LC_CTYPE, "en_GB.UTF-8");

I have committed this to the trunk after testing it on the dev server:

https://tech.transitionnetwork.org/trac/changeset?old_path=%2Fwww%2Ftrunk%2Fsites%2Fall%2Fmodules%2Fimageapi%2Fimageapi_imagemagick.module&old=213&new_path=%2Fwww%2Ftrunk%2Fsites%2Fall%2Fmodules%2Fimageapi%2Fimageapi_imagemagick.module&new=212

Jim - are you OK deploying it to live?

just before:

  $command = escapeshellarg($source) .' '. implode(' ', $args) .' '. escapeshellarg($dest);

comment:4 Changed 5 years ago by jim

Yes no probs... I've got some more updates to do early next week so it'll get done then.

Note: See TracTickets for help on using tickets.