定制 alpshq/statamic-asset-collector 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

alpshq/statamic-asset-collector

最新稳定版本:v1.0.1

Composer 安装命令:

composer require alpshq/statamic-asset-collector

包简介

Collects used assets.

README 文档

README

Asset Collector

Collect all used assets

Easily manage and showcase image credits on your website with Asset Credit Collector. This addon helps you collect all assets used on a page, allowing you to display image credits and other information effortlessly. Primarily designed for displaying image credits, Asset Collector can also be used to manage any list of assets on your site.

Installation

You can install the addon using composer:

composer require alpshq/statamic-asset-collector

Alternatively you can install the addon by navigating to Statamic's marketplace within your Control Panel and searching there for Asset Collector.

Usage

There is no configuration or setup needed. Everytime an asset's URL is requested, the asset is memorized.

You can get all these assets by using the collected_assets tag:

{{ collected_assets }}
    <!-- Do something with your assets. -->
{{ /collected_assets }}

Filter Assets by Type

If you want to get only some of the assets you've used you can use the collected_assets:some tag. The tag supports the following parameters which help you filter the assets you need:

Parameter Name Type Default Value Explanation
image bool false Whether or not to include images.
svg bool false Whether or not to include SVGs.
video bool false Whether or not to include videos.
audio bool false Whether or not to include audios.
pdf bool false Whether or not to include PDFs.

Example Usage with Filters

{{ collected_assets:some image="true" }}
    <-- Do something with the images which were placed on the current page -->
{{ /collected_assets:some }}

{{ collected_assets:some image="true" svg="true" }}
    <-- You can also combine filters. -->
{{ /collected_assets:some }}

Example: Display Credits

Display credits at the end of your page for all images placed on the current page.

{{ used_assets = { collected_assets:some image="true" svg="true" } }}

{{ if used_assets }}
    <div>
        Image Credits:

        <ul>
            {{ used_assets }}
                <li>
                    <a href="{{ url }}" target="_blank">{{ title | lowercase }}</a>
                    &copy; by
                    <a href="{{ credit_link }}" target="_blank">{{ credit }}</a>
                </li>
            {{ /used_assets }}
        </ul>
    </div>
{{ /if }}

Example: Gallery

Generating a gallery or carousel of images used on the page.

{{ collected_assets:some image="true" }}
    <!-- Create an image gallery or carousel -->
    <img src="{{ url }}" alt="{{ alt }}" title="{{ title }}" />
{{ /collected_assets:some }}

Example: A List of Downloadable Files

Displaying a list of downloadable files (e.g., PDFs or other documents) used on the page.

<ul>
    {{ collected_assets:some pdf="true" }}
        <li><a href="{{ url }}" download>{{ title }}</a></li>
    {{ /collected_assets:some }}
</ul>

Security

If you encounter any security related issues, please email directly jakub@alps.dev instead of opening an issue. All security related issues will be promptly addressed.

License

This is commercial software. You may use the package for your sites. Each site requires its own license.

统计信息

  • 总下载量: 12
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2023-03-29