The `thumb` filter can be used to process the image URL obtained from `categoryDetail` or `pageDetail`?

Calendar 👁️ 72

When using the AnQiCMS template, we often encounter the need to handle image links, especially for thumbnail display. The system provides multiple methods to obtain images, one common issue is aboutthumbthe filter meetscategoryDetailorpageDetailThe combination of image fields in the tag.

First, let's understand the basic logic of AnQiCMS in image processing.AQuantCMS is committed to providing efficient content management, which also includes optimizing image resources.In the background content settings, we can configure the thumbnail processing method, size, and even set a default thumbnail.This means that the system has already intelligently processed the thumbnail version of the image when uploading or generating content.

When we go throughcategoryDetailTag to get category information, or through.pageDetailWhen getting the details of a single page, these tags' data structure usually contains a field namedThumbThe field. It can be seen from the document that whether it is a category detail or a single page detail, itsThumbThis field directly returns the thumbnail address after system processing. For example, when you need to display a category thumbnail, you can call it directly like this:

<div>分类缩略图:<img style="width: 200px" src="{% categoryDetail with name="Thumb" %}" alt="{% categoryDetail with name="Title" %}" /></div>

Or get the thumbnail of a single page:

<div>单页缩略图大图:<img src="{% pageDetail with name="Thumb" %}" alt="{% pageDetail with name="Title" %}" /></div>

As you can see,ThumbThe field has provided us with a ready-made thumbnail URL, and we do not need to perform any additional thumbnail processing.This is because AnQiCMS has already pre-generated and stored these thumbnails during the content creation and management process.

Then, when should we use it?thumbWhat about the filter?

thumbfor example, a filter (such as{{ image|thumb }}The original intention of the design of ) is to handle thoseOriginal, full-size image URLIt is used to dynamically convert it into a thumbnail. It is not intended for reprocessing images that have already been thumbnail processed.Imagine if your template has a custom field storing the original large image address of the article, or if you are loopingbannerListwas obtained at that timeitem.Logo(It is usually the original image), and you want to display it as a thumbnail in some place, at this timethumbThe filter comes into play. It will dynamically generate or return a thumbnail of the corresponding size based on this original image URL.

For example, when iterating over the Banner list, if you want to shrink the Banner's Logo image:

{% bannerList banners %}
    {% for item in banners %}
    <a href="{{item.Link}}" target="_blank">
        <img src="{{item.Logo}}" alt="{{item.Alt}}" />
        <div class="thumb">
          {{ item.Logo|thumb }}
        </div>
    </a>
    {% endfor %}
{% endbannerList %}

Here, item.Logois the original image address, through|thumbThe filter, we got its thumbnail version.

In summary, when you are usingcategoryDetailorpageDetailtags to get images, if you get isThumbThe field is already a thumbnail URL, you can use it directly. You do not need to apply it again.thumbfilter.thumbThe filter is mainly used to handle cases where you know the original large image URL and want AnQiCMS to dynamically generate its thumbnail.Understanding these two ways of obtaining and processing image URLs can help us display images more efficiently and accurately in the AnQiCMS template, and also better utilize the system's built-in image optimization capabilities.


Frequently Asked Questions (FAQ)

1. I can directly pass thecategoryDetailorpageDetailObtainedLogofield (usually a large image) tothumbDo the filter perform thumbnail processing?Absolutely, you can.LogoThe field usually returns the original large image address (or a larger image) for categories or single pages. If you want to display it in the template in a different wayThumbThe default thumbnail size provided to displayLogocan be used to{{ categoryDetail with name="Logo" }}or{{ pageDetail with name="Logo" }}The result, then through|thumbThe filter is processed. For example:<img src="{{ categoryDetail with name='Logo' }|thumb}" />.

2.thumbIs the thumbnail size generated by the filter fixed? Can I customize it? thumbThe thumbnail size generated by the filter is determined by the "Thumbnail Size" configured in the "Content Settings" of the AnQiCMS backend.If you need thumbnails of different sizes, you can adjust these global settings in the background.But it should be noted that these settings are applied to the entire site. If you want to implement more fine-grained on-demand customization of size, you may need to consider processing multiple sizes at the time of image upload, or using custom fields to store links to different size images.

3. If I amThumbField reusingthumbwhat will happen?In most cases, applying the thumbnail URL again to an image that has already been thumbnail processedthumbFiltering is redundant. According to AnQiCMS logic,ThumbThe field is itself a thumbnail URL, re-filtering may not produce additional image size changes, or may return the same result. **Practicality is to avoid this redundant operation and use directly.Thumbfield.

Related articles

How to get the thumbnail or the first image of the slideshow group in the `pageDetail` tag?

In website operation, well-designed single-page (such as "About Us", "Service Introduction", etc.) is the key to showcasing brand image and conveying core information.These pages often need rich visual elements to attract visitors, and the effective use of images is an indispensable part of it.For users of AnQiCMS, the ability to flexibly obtain and display the first image from a thumbnail or slideshow is an important capability to achieve this goal.AnQi CMS provides a powerful template tag system

2025-11-08

How to get the thumbnail and background Banner image of the `categoryDetail` tag?

In AnQi CMS, the visual presentation of a website is the key to attracting visitors and conveying the brand image.Category thumbnails and background banners play a significant role in web page design, as they can directly display category content and enhance the aesthetics and user experience of the page.Anqi CMS provides flexible and easy-to-use template tags `categoryDetail`, which helps us easily obtain and display these visual elements.### Understanding the `categoryDetail` tag `categoryDetail`

2025-11-08

How to use the `archiveList` tag to display the thumbnail of each article on the list page?

In Anqi CMS, to make your website's content list page more attractive, displaying an eye-catching thumbnail for each article or product is the key to improving user experience and the beauty of the page.This not only helps visitors quickly understand the content topic, but also effectively improves the click-through rate.AnQiCMS provides an intuitive and powerful template tag feature, allowing you to easily achieve this goal on the list page.### Core Feature Revelation: `archiveList` Tag and Thumbnail The goal to be achieved in AnQiCMS

2025-11-08

What is the difference in fetching images between the `Logo` and `Thumb` fields in the `archiveDetail` tag?

When managing content in Anqi CMS, we often encounter various fields related to images, among which the `Logo` and `Thumb` fields under the `archiveDetail` tag often confuse new users.They all represent images, but there are very clear and practical differences in terms of usage and system processing.Understanding these differences can help us better plan the content of images, improve the loading speed of the website, and enhance the user experience.### `Logo` field

2025-11-08

In AnQiCMS image resource management, how to replace an image while keeping the original URL unchanged?

In website content operation, images are indispensable visual elements that can effectively enhance the attractiveness and reading experience of the content.However, as the operation deepens, we often need to update the images to reflect the latest products, services, or design styles.

2025-11-08

How to prevent uploading large images from affecting the page loading speed in AnQiCMS?

## Using AnQiCMS, easily say goodbye to large image lag: full analysis of optimization strategies In today's digital age, website loading speed is a key factor in user experience and search engine rankings.Among them, images as an important part of content display are often also the main culprits that slow down the speed of the website.An unoptimized large image not only consumes a lot of bandwidth but also significantly prolongs the page loading time, leading to user loss.

2025-11-08

How to use the AnQiCMS image optimization feature to improve the SEO performance of the website?

In the context of the increasingly important content marketing and search engine optimization (SEO), the quality and optimization of website images have a significant impact on the overall performance of the website.Images not only enhance user experience and make content more attractive, but are also one of the important dimensions for search engines to evaluate website quality.High-quality image optimization not only speeds up page loading, but also helps search engines better understand the content of the image through correct attribute settings, thereby bringing more natural traffic to the website.

2025-11-08

Does AnQiCMS support setting independent thumbnail rules for different types of content (such as articles, products)?

In website operation, images, especially thumbnails, play a crucial role in attracting user clicks and unifying the website's visual style.For different types of content, such as a detailed article and a beautiful product, we naturally hope to have different thumbnail display rules.So, what kind of support does AnQiCMS provide in this aspect?AnQiCMS as a flexible content management system indeed provides a diverse range of management methods for content display.

2025-11-08