PHP中的图像拼贴 [英] image collage in PHP

查看:146
本文介绍了PHP中的图像拼贴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个精简的解决方案,或者可能是一些数学/算法用于从较小的产品图片中创建大图像拼贴?
我知道如何以方形方式进行,使用gd / imagemagick的相同大小的图片,但我想内置一些变化。

I'm looking for a finshed solution or possibly some math/algorithms for creating a big image collage out of smaller product pictures? I know how to do it in a square fashion, from same sized pictures with gd/imagemagick but I'd like to have some variation built in.

例如,一些图片可能会稍微高一些,如果所有图片的尺寸和方形相同 - 我可能会想要其中一个占用更多空间,只是为了混淆设计。让它变得有趣。

For example, some of the pictures might be slightly taller, and if all are the same size and square - i might want 1 of them take up more space, just to mix up the design. keeping it interesting.

我想的越多,它似乎越难以使用公式。为所有可能的场景预定义模板是行不通的,因为图片数量可能从1(不需要工作)到10 +不等。

the more i think about this the harder it seems to do with a formula. having predefined "templates" for all the possible scenarios isn't going to work since the amount of pictures could vary from just 1 (no work needed) to 10+.

我不是在寻找任何旋转或特殊效果,只是网格中的图像可能有一些间距而且没有重叠。

i'm not looking for any rotation or special effects, just the images in a grid with maybe some spacing inbetween and no overlapping.

任何想法如何实现这一点,以及真的没有什么可以去的吗?

any ideas how to accomplish this, and is there really nothing ready to go out there?

推荐答案

我建议你创建一个网格和权重方法。

I suggest you to create a grid and weight approach.

这个答案分为3部分:


  1. 使用虚拟网格

  2. 随机将图像部署到该网格中

  3. 实施透明度

  1. Working with a virtual grid
  2. Randomly dispose image into that grid
  3. Implement transparency

这篇关于PHP中的图像拼贴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆