H
H
honormgr2017-01-14 11:59:29
ImageMagick
honormgr, 2017-01-14 11:59:29

How to pass variable to Image Intervention function?

Hello!
Need help!
I have an array where the colors are stored, I need to pass it to the library function image.intervention.io/api/rectangle
Specifically like this -

// draw transparent rectangle with 2px border
$img->rectangle(5, 5, 195, 195, function ($draw) {
    $draw->background($menu['color']);
    $draw->border(2, '#000');
});

The variable exists, but Laravel says it doesn't exist!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2017-01-14
@kentuck1213

$img->rectangle(5, 5, 195, 195, function ($draw) use($menu){
    $draw->background($menu['color']);
    $draw->border(2, '#000');
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question