问题:
I'm a beginner at rails programming, attempting to show many images on a page.我是 Rails 编程的初学者,试图在页面上显示许多图像。 Some images are to lay on top of others.有些图像要放在其他图像之上。 To make it simple, say I want a blue square, with a red square in the upper right corner of the blue square (but not tight in the corner).为了简单起见,假设我想要一个蓝色方块,在蓝色方块的右上角有一个红色方块(但在角落处不紧)。 I am trying to avoid compositing (with ImageMagick and similar) due to performance issues.由于性能问题,我试图避免合成(使用 ImageMagick 和类似的)。
I just want to position overlapping images relative to one another.我只想相对于彼此定位重叠的图像。
As a more difficult example, imagine an odometer placed inside a larger image.作为一个更困难的例子,想象一个里程表放置在一个更大的图像中。 For six digits, I would need to composite a million different images, or do it all on the fly, where all that is needed is to place the six images on top of the other one.对于六位数字,我需要合成一百万张不同的图像,或者即时完成所有操作,只需将六个图像放在另一个图像的顶部。
解决方案:
参考一: https://en.stackoom.com/question/Cbq参考二: https://stackoom.com/question/Cbq