从 Tumblr 照片集中提取第一张图像?
我正在为一位婚礼摄影师设计一个主题,他想要使用 Tumblr 的 Photoset 功能创建一个作品集网站。
如何从照片集中提取第一张图像,以便创建一个主页,其中包含链接到每个集合的单个缩略图预览(大小根据我的选择)?
谢谢, 帕里
I'm designing a theme for a wedding photographer who wants to use Tumblr's Photoset functionality to create a portfolio site.
How do I pull the first image from a photoset so I can create a home page with a single thumbnail preview (sized to my choosing) that links to each set?
Thanks,
Parri
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
似乎没有办法限制它们,但您可以将它们注释掉。此解决方案的优点是根本不会加载隐藏图像并且不需要任何 javascript
请参阅
关闭注释。完成后,照片集中第一张图像之后的所有图像都将被隐藏。
There doesn't seem to be a way to limit them, but you can comment them out. This solution has the advantage that the hidden images won't be loaded at all and it doesn't need any javascript
See that
<!--
before{/block:Photos}
? That opens an HTML comment right after the first image, so the rest of the images in the loop will be in a comment, invisible. After the loop we close the comment with-->
. Done, all the images in the photoset after the first one will be hidden.Tumblr 标记:
注意:您可能需要
{PhotoURL-75sq}
来输出方形预览而不是 500 像素图像;CSS:
Tumblr markup:
Note: may be you need
{PhotoURL-75sq}
to output square preview instead of 500px image;CSS:
上面的例子是有缺陷的,因为用户必须下载所有图像,即使只显示第一个图像,所以我使用 jquery 只注入第一个图像。
HTML(简化):
javascript(简化):
这确保仅加载第一个图像...您始终可以将上面的其他 css 示例放在 noscript 标记中,以防它们关闭了 javascript。
希望有帮助
the above example is flawed as the user has to download all the images even though only the first is shown so instead I've used jquery to inject only the first image.
HTML (simplified):
javascript (simplified):
This ensures only the first image is loaded... you can always have the other css example above in a noscript tag incase they have javascript turned off.
Hope that helps