Search

Here's an odd scenario:

I have a remote datasource that imports blog-style content. Included with each entry is a url for an image. Every entry always has one image url—no more, no less. No further metadata included in the XML. In other words, the imported data is relatively inflexible.

The referenced images come in all different shapes and sizes, so I have a simple JIT manipulation on the image. Everything has been working fine, until I noticed one of the images coming in is a broken link.

It turns out one of these referenced images is in cmyk color space. That's why JIT wasn't doing anything. I've read other discussions here about JIT and CMYK. However, this scenario seems uniquely difficult since I'm manipulating a remote datasource and don't have much control over the input.

Any ideas on how to make this better?

There's actually an open issue for this already. I think the GD library 2.0.22+ supports reading of a CMYK image and then outputting to RGB mode so it should, in theory, be possible to add support for in JIT. It's a long standing issue by the look of it though so I'm not sure if there are other complications or if other work has just taken priority.

If you're in a hurry for it then you'd probably either need to look to make the modifications to JIT yourself or to work around it by reading the remote images, processing them with GD and saving to the filesystem as RGB and read from the saved conversions. It's always been a tricky conversion to make but I think that conversion from CMYK to RGB should be possible with the most support added in the GD lib - just not the other way around.

Short term solution until a resolution is made is to check if you have at least GD version 2.0.22 installed.

Then alter the lines here in your local copy of JIT: https://github.com/symphonycms/jit_image_manipulation/blob/master/lib/class.image.php#L102-L108

Replace the highlighted lines with just the imagecreatefromjpeg function:

$resource = imagecreatefromjpeg($image);

See if that works for you.

The integration branch now has this fix in by default.

Just getting back to this after a few days away. Andrew—your suggested changes worked perfectly. So glad it was such a quick fix. Thanks!

@nigel, The integration branch of the JIT repo has a more solid solution already in place thanks to @brendo.. I think this branch is 2.4 and upwards compatible only I think.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details