本文介绍了在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.

此答案分为三个部分:

  1. 使用虚拟网格
  2. 将图像随机放置到该网格中
  3. 实施透明度
  1. Working with a virtual grid
  2. Randomly dispose image into that grid
  3. Implement transparency

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

08-31 04:33