Transform a image with Javascript

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2017 04:33 AM
Hello, I have a problem to transform an image. I use a javascript script found in the Alfresco documentation. My version is 5.2. The script :// convert an image to JPG format and resize to thumbnail image
The log:
var thumbImage = document.transformImage('image/jpeg', '-resize 120');
ERROR [org.alfresco.repo.jscript.ScriptNode] [defaultAsyncAction4] 08110207 Unsupported transformation: transformer.ImageMagick image/jpeg to image/png
Screenshot :
The image is well converted but the resize does not work. The mimetype (property of the image) can not change.
Being a beginner, I can not understand the log message.
Thank you in advance for your help.
Olivier
- Labels:
-
Alfresco Content Services
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2017 05:27 AM
I had a problem with a "duplicate child name" when trying this.
var thumbImage = document.transformImage('image/jpeg', '-resize 120',document.parent.parent);
worked for me and the thumbnail is created on folder above the document (just for testing). But I didn't get the conversion error...
...ok, I first tried your original js-line with a png and everything works. The 120px Thumbnail is created. So it seems to be a problem with the setup.
I used Alfresco Community 5.2 on Ubuntu Linux and the image.magick version provided by alfresco installer for the test.
Regards,
Martin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2017 07:37 AM
Thank you Martin for your reply 🙂
Actually, I had modified the script mimetype line ('image/png'). I had the same error as you concerning the duplicate child name.
I have the same version as you (5.2 Community and the default version of ImageMagick). Did you modify settings particularly?
For additional info, I run the script with a rule on a folder? (as admin)
Did you test the script that way too?
Thanks in any case for your help 🙂
Olivier
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2017 07:50 AM
I didn't modify any settings - but I installed the "missing libraries" (Installing Linux libraries manually | Alfresco Documentation ) before the Installation of Alfresco.
When dealing with conversion problems, I add
log4j.logger.org.alfresco.repo.content.transform.TransformerDebug=debug
log4j.logger.org.alfresco.repo.content.transform.RuntimeExecutableContentTransformerWorker=debug
log4j.logger.org.alfresco.util.exec.RuntimeExecBootstrapBean=debug
log4j.logger.org.alfresco.util.exec.RuntimeExec=debug
to the custom-log4j.properties in tomcat/shared/classes/alfresco/extension
Using the mime types url (.../alfresco/service/mimetypes) you can see which conversions are possible for the configured mime type. The listing for image/jpeg is very long on my system.
Martin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2017 09:06 AM
Thank you Martin for your responsiveness. I will look at the side of the libraries because I modified the file "custom-log4j.properties" like you without success. I'll let you know. It's amazing anyway.
Olivier

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2017 09:19 AM
Martin,
Can you tell me if you have the same thing when you open in the list "Registered Mimetypes" jpg or png: I have this: Transformable To: Can not be transformed into anything else
Olivier
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2017 09:25 AM
As I said above, I have many entries for the conversions:
image/jpeg - jpg
- application/eps = Proxy via: com.sun.proxy.$Proxy27 (Version: ImageMagick 6.9.1-10 Q16 x86_64 2015-08-12 http://www.imagemagick.org Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC License: http://www.imagemagick.org/script/license.php Features: Cipher DPC Modules Delegates (built-in): freetype jng jpeg ltdl png tiff wmf)
- image/bmp = Proxy via: com.sun.proxy.$Proxy27 (Version: ImageMagick 6.9.1-10 Q16 x86_64 2015-08-12 http://www.imagemagick.org Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC License: http://www.imagemagick.org/script/license.php Features: Cipher DPC Modules Delegates (built-in): freetype jng jpeg ltdl png tiff wmf)
- image/cgm = Proxy via: com.sun.proxy.$Proxy27 (Version: ImageMagick 6.9.1-10 Q16 x86_64 2015-08-12 http://www.imagemagick.org Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC License: http://www.imagemagick.org/script/license.php Features: Cipher DPC Modules Delegates (built-in): freetype jng jpeg ltdl png tiff wmf)
- image/gif = Proxy via: com.sun.proxy.$Proxy27 (Version: ImageMagick 6.9.1-10 Q16 x86_64 2015-08-12 http://www.imagemagick.org Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC License: http://www.imagemagick.org/script/license.php Features: Cipher DPC Modules Delegates (built-in): freetype jng jpeg ltdl png tiff wmf)
- image/ief = Proxy via: com.sun.proxy.$Proxy27 (Version: ImageMagick 6.9.1-10 Q16 x86_64 2015-08-12 http://www.imagemagick.org Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC License: http://www.imagemagick.org/script/license.php Features: Cipher DPC Modules Delegates (built-in): freetype jng jpeg ltdl png tiff wmf)
- image/jp2 = Proxy via: com.sun.proxy.$Proxy27 (Version: ImageMagick 6.9.1-10 Q16 x86_64 2015-08-12 http://www.imagemagick.org Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC License: http://www.imagemagick.org/script/license.php Features: Cipher DPC Modules Delegates (built-in): freetype jng jpeg ltdl png tiff wmf)
- image/png = Proxy via: com.sun.proxy.$Proxy27 (Version: ImageMagick 6.9.1-10 Q16 x86_64 2015-08-12 http://www.imagemagick.org Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC License: http://www.imagemagick.org/script/license.php Features: Cipher DPC Modules Delegates (built-in): freetype jng jpeg ltdl png tiff wmf)
- image/tiff = Proxy via: com.sun.proxy.$Proxy27 (Version: ImageMagick 6.9.1-10 Q16 x86_64 2015-08-12 http://www.imagemagick.org Copyright: Copyright (C) 1999-2...
and so on...
also for png:
image/png - png
- application/eps = Proxy via: com.sun.proxy.$Proxy27 (Version: ImageMagick 6.9.1-10 Q16 x86_64 2015-08-12 http://www.imagemagick.org Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC License: http://www.imagemagick.org/script/license.php Features: Cipher DPC Modules Delegates (built-in): freetype jng jpeg ltdl png tiff wmf)
- image/bmp = Proxy via: com.sun.proxy.$Proxy27 (Version: ImageMagick 6.9.1-10 Q16 x86_64 2015-08-12 http://www.imagemagick.org Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC License: http://www.imagemagick.org/script/license.php Features: Cipher DPC Modules Delegates (built-in): freetype jng jpeg ltdl png tiff wmf)
- image/cgm = Proxy via: com.sun.proxy.$Proxy27 (Version: ImageMagick 6.9.1-10 Q16 x86_64 2015-08-12 http://www.imagemagick.org Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC License: http://www.imagemagick.org/script/license.php Features: Cipher DPC Modules Delegates (built-in): freetype jng jpeg ltdl png tiff wmf)
- image/gif = Proxy via: com.sun.proxy.$Proxy27 (Version: ImageMagick 6.9.1-10 Q16 x86_64 2015-08-12 http://www.imagemagick.org Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC License: http://www.imagemagick.org/script/license.php Features: Cipher DPC Modules Delegates (built-in): freetype jng jpeg ltdl png tiff wmf)
- image/ief = Proxy via: com.sun.proxy.$Proxy27 (Version: ImageMagick 6.9.1-10 Q16 x86_64 2015-08-12 http://www.imagemagick.org Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC License: http://www.imagemagick.org/script/license.php Features: Cipher DPC Modules Delegates (built-in): freetype jng jpeg ltdl png tiff wmf)
- image/jp2 = Proxy via: com.sun.proxy.$Proxy27 (Version: ImageMagick 6.9.1-10 Q16 x86_64 2015-08-12 http://www.imagemagick.org Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC License: http://www.imagemagick.org/script/license.php Features: Cipher DPC Modules Delegates (built-in): freetype jng jpeg ltdl png tiff wmf)
- image/jpeg = Proxy via: com.sun.proxy.$Proxy27 (Version: ImageMagick 6.9.1-10 Q16 x86_64 2015-08-12 http://www.imagemagick.org Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC License: http://www.imagemagick.org/script/license.php Features: Cipher DPC Modules Delegates (built-in): freetype jn...
and so on...
also for the "Transformable from" Types.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2017 09:31 AM
Thanks Martin. My problem certainly comes from that. I do not have that configuration.
I will look at how to configure this part that is not configured by default in my case. (I'm under microsoft windows)
It going 🙂 Thanks again 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2017 09:47 AM
looks like image magick isn't working as expected on your installation. Tried to call it directly under Windows? Should work and give no errors.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2017 04:36 AM
Hi Martin, Thank you for your help because by creating a file "imagemagick-transform-context.xml", I was able to find the settings you have in your file. The conversion works 🙂 Super! I use a bit but little you tell me when the image is resized if you have the correct exif (width and height). For in my case, the exifs are the same as the original. This causes me a problem because I have to use this image in a software that does not recognize it. Thanks again Martin, it's really nice to have answered my request. Olivier
