原图: 这里我需要什么: 应该从这个小瓦创建: 如何在不使用exec函数的情况下制作平铺的图像帧?
很多人建议使用ImageMagick的解决方案(使用PHP exec函数吧) - 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
或
PICFrame溶液(使用PHP exec函数它) - 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具有创建彩色边框与伟大的能力:
$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();
但是PHP imagick不能使用自己的图像平铺创建框架,只有纯色。这是非常相关的问题 - How to flood fill the frame with a pattern image using imagick php class?
另一个很好的解决方案 - https://stackoverflow.com/a/28778953/2337706,但它创建大的PNG帧的图像,你应该知道正确的图像大小。
我知道,我可以用PHP GD创建 - http://php.net/manual/en/ref.image.php,但我不知道如何实现它这样正确的方法。
什么是错的使用PHP的exec()调整颜色的厚度?这使得它可以很容易地使用预先存在的解决方案,而不必去创造它一遍 – fmw42
@ fmw42是的,你是对的,它很容易使用,方便易,但使用了很多客户的共享主机不提供访问到PHP exec()或者我不是? – kostya572
我对Imagick并没有太多的尝试,并没有尝试过,但是http://us3.php.net/manual/en/imagick.textureimage.php是将平铺图像的函数。你应该能够使用它来实现你想要的结果。 – fmw42