Original image: Here what i need: It should be created from this small tile:
A lot of people suggest to use ImageMagick solution (it using php exec function) - http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=21867:
convert frame_template.gif \
-tile blackthin_top.gif -draw 'color 1,0 floodfill' -rotate 90 \
-tile blackthin_btm.gif -draw 'color 1,0 floodfill' -rotate 90 \
-tile blackthin_top.gif -draw 'color 1,0 floodfill' -rotate 90 \
-tile blackthin_btm.gif -draw 'color 1,0 floodfill' -rotate 90 \
-gravity center thumbnail.gif -composite frame_filled.gif
or
PICFrame solution (it using php exec function) - http://www.fmwconcepts.com/imagemagick/picframe/index.php:
picframe [-f frameid] [-m mattesize] [-c mattecolor] [-b bordersize] [-s shade] [-a adjust] [-o opacity ] [-d distance] infile outfile
PHP imagick has great ability to create color borders with:
$imagick = new \Imagick('image.jpg');
$imagick->scaleImage(300, 300, false);
// Create frame placeholder
$imagick->frameimage( 'red','30','30', 30, 0);
// Flood fill with color
$imagick->floodFillPaintImage('green', 10, '#6e0000',0, 0,false
);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
But PHP imagick can't use your own image tile to create frame, only solid colors. Here is very related question - How to flood fill the frame with a pattern image using imagick php class?
Another good solution from - https://stackoverflow.com/a/28778953/2337706 but it creates image from big PNG frames and you should know correct image size.
I know that i can create it with php GD - http://php.net/manual/en/ref.image.php but i don't know correct way how implement it this way.