Search

I am scaling an image, using symphony, into a square. Symphony, as you know, fills in black around what is missing if the dimensions of the image are not a square. But I was wondering if there is somewhere where I can turn this from black to white or another color.

There is a parameter for background-color. But be warned: I haven’t used JIT yet. :-)

I never looked that that page before, terrific resource. Problem is it tells you go go into System > Preferences to change/add a hex color for it to be, but I cant figure out how to do that.

you can change the background color adding the correct parameters to the url of the image

You have something like this, note the hex value

<img title="{title}" alt="{alt}">
    <xsl:attribute name="src">
        <xsl:value-of select="$root" />/image/3/300/600/1/ff0000<xsl:value-of select="image/@path" /><xsl:text>/</xsl:text><xsl:value-of select="image/filename" />
    </xsl:attribute>
</img>

Background color only works with mode 3 (Resize Canvas) and p (Cropping position point).

In the past there has been a bug whereby if you use mode 2 (Resize and Crop) then it also adds the black edges. But Resize and Crop should never do this — it should resize and crop the image to fit the canvas. If this is occurring and you’re using mode 2, then this bug is back.

Mine looks like this:

<img src="{$root}/image/2/100/100/5/ff0000/images/{[image-field]/.}" />

I dont know why it wont work. I guess it has to be formatted differently…

What I dont understand about this, after reading this guide, and listening to angelo, is that the background color only works when the image is using mode 3, which keeps it at its original size, but then it wont scale (and it will stay full size but be cropped) meaning most likely than not it will fill out the image area. Meanwhile, when I have a rectangle that needs to go into a 100x100 thumbnail, it will not display if I put the HEX color in the image call, and subsequently the only way it will display is to take out the HEX color, and then it puts black (by default) on the left and right (to fill out the square), like so:

example

But doesn’t this defeat the purpose???

As I said earlier, I think this is a bug with the mode 2 (Resize and Crop). I was under the impression that this mode shouldn’t ever show the background colour, since it will resize the image along the smallest side, and crop. So in your example, it would resize so that the image was 100px wide, but the top and bottom are cropped off since the aspect ratio of the final image is different from the first.

To get the desired result, do you not want to use Resize Canvas mode (3) with the background colour?

You can also pass 0 for either the width or height, and these will be calculated automatically.

Hey Nick, strange though, the only way the background color works is in the cases where the image fills the image area and you cant see the background color. I want to preserve the picture ratio on these and not crop them. But when there is one that is, say 300px tall and 200px wide, and you try to cram it into a 100x100 image, scaling and not cropping, it puts the black. I mostly did this because I didnt know you can put a zero value for the width which will just scale it, preserving the ratio according to what you set the height at. I think I might just go for that and have the width depend on the original ratio rather than have every one be 100x100.

i know this thread is kinda old but since this has not been finally answered and the concept documentation for JIT is still the same i thought maybe can shine a light on this. what i need is basically scaling the image in proportion with variable width and then adding whitespace to the sides until width is equal to height. i attached a quick sketch to illustrate what i mean.

maybe there is already a way to generate this with the current modes and it just does not reveal itself to me ;)

thanks
daniel

Attachments:
jit.png

Hi there Do you want to adjust the image color when scaling the image? I also want to know the easy method to adjust the image color.But My image program can not do that.Is there any free program ?Thanks for any suggestion.

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