solved Image Core crop filling color

Melih
Melih
@melih
6 years ago
198 posts
I really liked Image Support Module's latest update. It hase been very helpfull that the Resize Images Tool included also the custom modules because each time there was a new update i had to add my modules in to the function. So thank you very much for this.

Now there is only one part left i have to change manually for Image Support Module. I change the crop filling color (in include.php line 2113, "$color = imagecolorallocate($image['handle'], 0, 0, 0);" to gray from black because gray suits my page better :) If there were a setting to change this color it would be very usefull. If you consider adding this setting to acp on the next update i would really appreciate it.
updated by @melih: 06/19/18 07:38:44AM
brian
@brian
6 years ago
10,136 posts
When cropping I'm not sure a fill color is used - are you cropping to a smaller size than the image size to get "borders"? Let me know how you're using it so I can check it out.

Thanks!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
Melih
Melih
@melih
6 years ago
198 posts
Hey Brian, i hope everything is alright with you!

Actually i'm talking about the featured profiles slider on the Genosis' main page.
jrImage's include.php, line 2111
// If crop=fill we need to fill the image in first
    if (isset($_post['crop']) && $_post['crop'] == 'fill') {
        $color = imagecolorallocate($image['handle'], 0, 0, 0);
        imagefilledrectangle($image['handle'], 0, 0, $_post['width'], $_post['height'], $color);
    }

I change those 0s of the imagecolorallocate to, for example 249 to change filling color of the featured profiles slider on the main page.
updated by @melih: 03/11/18 09:14:39AM
brian
@brian
6 years ago
10,136 posts
There is a new "fillcolor" option in the next Image Support module release that will support this - so instead of having to modify the module just add it to the URL or the template image call - i.e.

&crop=fill&fillcolor=0:0:0

So it is:

red:blue:green

with valid values from 0 -> 255 for each.

Let me know if that works.

Thanks!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
Melih
Melih
@melih
6 years ago
198 posts
I am looking forward to it! I will try it the second i get the update ;) Thank you Brian! Have a great day
brian
@brian
6 years ago
10,136 posts
This has been added in Image Support 2.0.8 - update and let me know if that works for you.

Thanks!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
Melih
Melih
@melih
6 years ago
198 posts
Hello Brian!

I am sorry to tell you that but it's not working correctly. I think there is a problem with the 3rd one (green). Red adn Blue is working.
brian
@brian
6 years ago
10,136 posts
Can you show me how you're using it? The code appears correct:

        if (empty($_post['fillcolor'])) {
            $r = 0;
            $g = 0;
            $b = 0;
        }
        else {
            @list($r, $g, $b) = explode(':', $_post['fillcolor'], 3);
            if (!isset($r) || !jrCore_checktype($r, 'number_nn')) {
                $r = 0;
            }
            if (!isset($g) || !jrCore_checktype($g, 'number_nn')) {
                $g = 0;
            }
            if (!isset($b) || !jrCore_checktype($b, 'number_nn')) {
                $b = 0;
            }
        }
        $color = imagecolorallocate($image['handle'], $r, $g, $b);

Thanks!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
Melih
Melih
@melih
6 years ago
198 posts
jrGenosis/index_featured_slider.tpl

Line 8:
{jrCore_module_function function="jrImage_display" module="jrProfile" type="profile_image" item_id=$item._profile_id size="xxxlarge" crop="fill&fillcolor=249:249:249" class="img_scale" alt=$item.profile_name title=$item.profile_name}

and the output is like this:
<img class="img_scale" src="http://www.egricayir.org/profile/image/profile_image/63/xxxlarge/crop=fill&fillcolor=249:249:249/_v=1413890003" alt="Dila Tuana Eğriçayır" title="Dila Tuana Eğriçayır" width="800">

But the color isn't grey, it's yellow like 249:249:0
updated by @melih: 03/20/18 11:34:34AM
brian
@brian
6 years ago
10,136 posts
I'm not seeing any issues here:

https://www.jamroom.net/forum/image/forum_file/56991/xxlarge/crop=fill/fillcolor=249:249:249

Let me know if that looks like super light gray to you - it does for me.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
brian
@brian
6 years ago
10,136 posts
ah wait - you're doing it wrong. It should be:

{jrCore_module_function function="jrImage_display" module="jrProfile" type="profile_image" item_id=$item._profile_id size="xxxlarge" crop="fill" fillcolor="249:249:249" class="img_scale" alt=$item.profile_name title=$item.profile_name}

"fillcolor" is a separate parameter.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
Melih
Melih
@melih
6 years ago
198 posts
Oh, really! Silly me! Let me try it
Melih
Melih
@melih
6 years ago
198 posts
I did try but i couldn't make it:
I literally copy and paste what you wrote in case i wrote it wrong but now it doesn't work at all

output is like this:

<img class="img_scale" src="http://www.egricayir.org/profile/image/profile_image/122/xxxlarge/crop=fill/_v=1452764386" alt="Arden Metin" title="Arden Metin" width="800">

http://www.egricayir.org/profile/image/profile_image/122/xxxlarge/crop=fill/_v=1452764386
brian
@brian
6 years ago
10,136 posts
Well we can see it working here:

http://www.egricayir.org/profile/image/profile_image/122/xxxlarge/crop=fill/fillcolor=249:249:249/_v=1452764386

so it might be something in the smarty function call - I can check it out. For now just use the actual URL in your template.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
Melih
Melih
@melih
6 years ago
198 posts
Ok Brian, thank you! Please let me know if you find a solution.
brian
@brian
6 years ago
10,136 posts
This should be working now - reload Image Support 2.0.8 from the Marketplace and let me know if that works better.

Thanks!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
Melih
Melih
@melih
6 years ago
198 posts
Thank you Brian, it is working now. It's perfect! Have a great day.
brian
@brian
6 years ago
10,136 posts
Melih:
Thank you Brian, it is working now. It's perfect! Have a great day.

Awesome - glad to hear that - thanks!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net

Tags