How to effectively retrieve and display a thumbnail, cover main image, or a collection of multiple images for an article?

Calendar 👁️ 79

In content operation, engaging images are essential elements to attract readers and enhance the quality of articles.AnQiCMS (AnQiCMS) understands this and provides a diverse and flexible set of features, whether it's for the thumbnails of article lists, the cover images of detailed pages, or the rich multi-image collections, all can be easily obtained and displayed in the way you expect.

How does Anqi CMS handle various images?

In Anqi CMS, images are usually divided into several types to meet the display needs of different scenarios:

  • Article thumbnail (Thumb):This type of image is mainly used for article lists, recommendation positions, and other scenarios, providing a quick overview of article content with small-sized images.The Anqi CMS is very intelligent, when you publish an article, even if you do not manually upload a thumbnail, the system will automatically extract the first image from the article content as a thumbnail.Of course, you can also manually upload or select an image from the image library as a custom thumbnail according to your needs.
  • Cover main image (Logo):The cover image usually refers to the main visual image of an article, product, or page, which is larger than the thumbnail and occupies a prominent position in the detail page or an important display area, carrying the core visual expression of the content.
  • A collection of multiple images (Images/Group image):When you need to display a set of related images, such as product details, event highlights, or design portfolios, AnQi CMS supports managing and displaying multiple images as a collection.This makes creating a picture gallery or slideshow effortless.

Not limited to articles, categories (Category) and single pages (Page) also support setting independent cover logos (Logo), thumbnails (Thumb), and sets of images (Images), which means you can manage unified or personalized visual content management at various levels of the website.

Image optimization and management in the background settings

To ensure the access speed and image display effect of the website, Anqi CMS provides a wealth of image optimization and management options in the background, allowing you to perform professional processing without any additional tools:

  1. Intelligent upload and storage:
    • WebP format conversion:You can choose to enable the WebP format conversion feature.WebP is a modern image format that can significantly reduce file size while maintaining image quality, thereby speeding up web page loading and enhancing user experience and SEO performance.After turning on, newly uploaded JPG, PNG images will be automatically converted to WebP format.
    • Automatically compress large images:If you do not want the original large image to take up too much server space or affect loading speed, you can enable the automatic compression of large images and set a specified width.The system will resize the image proportionally, effectively controlling the size of the image.
    • Remote Image Download:If your article content references external image links, the system can be configured to automatically download these remote images to the local, for convenient unified management and accelerated access.
  2. Thumbnail strategy fine control:
    • Thumbnail size:You can flexibly set the uniform size of thumbnails according to the needs of website design and front-end display to ensure consistency of visual style.
    • Thumbnail processing method:For different scenarios, AnQi CMS provides various thumbnail generation methods, including "proportionally scaling to the longest side" to display the image in full, "filling with blank space around the longest side" to display at a fixed size, and "cropping to the shortest side" to center-crop the image.
    • Default thumbnail: To avoid the display from being unattractive due to missing images, you can set a default thumbnail that will be automatically called when there is no specified image.
    • Batch regenerate: After you adjust the thumbnail size or processing method, you can use the batch function to regenerate all thumbnails with one click, ensuring that all images on the site are updated uniformly.
  3. Image library management:The Anqi CMS is built with powerful image resource management features, allowing you to categorize all uploaded images and videos uniformly, perform batch operations (such as delete, transfer categories), and view detailed information (file name, type, size, resolution, address, etc.).This makes the management of image materials organized and easily accessible at any time.

Flexibly call images in the template

In the website front-end template, Anqi CMS provides an intuitive and powerful tag system that allows you to easily call and display various images as needed.

  • Universal image field:
    • Whether it is througharchiveListUse to call the article list, orarchiveDetailYou can get the article details directly through{{ item.Thumb }}Get the thumbnail address through{{ item.Logo }}Get the cover main image address.
    • For a multi-image collection, such asitem.Imagesit is usually an array of image URLs. You can useforto iterate through this array and display each image, easily building an image gallery. For example:
      
      {% for image_url in item.Images %}
          <img src="{{ image_url }}" alt="{{ item.Title }} 细节图" />
      {% endfor %}
      
  • Category and image call for single page:Similar articles,categoryDetail(Category details) andpageDetail(Single page details) tags also support through{{ category.Logo }}/{{ category.Thumb }}and{{ category.Images }}The way to obtain and display the main image, thumbnail, or a collection of multiple Banner images for a category or single page.
  • Dynamic thumbnail generation:AnQi CMS also provides a practicalthumbFilter. If you need to dynamically generate a thumbnail of a specific size based on the original image address in a template (for example, when a different thumbnail size is needed in a special layout than the background preset), you can use{{ image_url|thumb }}. This filter will return the thumbnail address of the corresponding size based on the thumbnail rules set in your background.
  • Image in the custom field:By using a flexible content model, you can customize additional image fields for articles, products, etc., such as a field namedproduct_gallerya group image field. In the template, you can usearchiveParamsLabel to retrieve these custom field data and use them similarlyforLoop to display images:
    
    {% archiveDetail productGallery with name="product_gallery" %}
    {% if productGallery %}
        <div class="product-gallery">
        {% for img_path in productGallery %}
            <img src="{{ img_path }}" alt="产品展示图" />
        {% endfor %}
        </div>
    {% endif %}
    

With these rich features and flexible calling methods, Anqi CMS provides you with a comprehensive visual content management solution, helping your website content to be more attractive and expressive.Whether it is the beauty of content display or the loading performance of the website, it can be effectively guaranteed.

Frequently Asked Questions (FAQ)

Q1: Why do the images I upload sometimes look blurry or the file size is still very large?A1: This usually relates to your background content settings. Please check the options for 'Whether to automatically compress large images' and 'Thumbnail size' in the 'Content Settings'.If the image is over-compressed or the thumbnail size is too small, it may cause blurring.At the same time, ensure

Related articles

How to retrieve and display the title, detailed content, summary, and recommended attributes of an article (document)?

In Anqi CMS, whether it is to display the detailed content of a single article or to preview multiple articles on the list page, flexibly obtaining and displaying the title, detailed content, introduction, and recommended attributes of the article is the foundation of website operation.The design of Anqi CMS makes this process intuitive and efficient, we mainly achieve it through template tags and variable calls.First, understand the template system of Anqi CMS is crucial.

2025-11-07

How does AnQiCMS support the switching of multiple templates, as well as how to specify an independent template for a specific page or content type?

## The flexible aspects of AnQiCMS: How to handle multi-template switching and personalized page design A flexible template mechanism is crucial for a content management system to maintain competitiveness and adapt to diverse operational needs.AnQiCMS is an efficient enterprise-level content management system that has demonstrated excellent capabilities in this regard. It not only supports multi-template switching at the whole-site level but also provides detailed features for specifying independent templates for specific pages or content types. This is undoubtedly a powerful tool for websites that need to carry out refined content operations. Firstly

2025-11-07

How to use the `for` loop tag to iterate and display list data in AnQiCMS template?

In AnQiCMS templates, dynamically displaying list data is one of the core operations for building rich website content.Whether it is displaying the latest articles, hot products, category lists, or any custom content collection, the `for` loop tag is your helpful assistant.It allows you to easily traverse data and customize the display of each item according to your needs.Understanding the basics of the `for` loop tag The `for` loop tag is a control structure in the AnQiCMS template engine used for iterating over collection data.

2025-11-07

How to use `if-else` conditional tags to control the display logic of content in AnQiCMS templates?

In AnQiCMS templates, make good use of the `if-else` conditional judgment tag to make content display more intelligent In website content operation, we often need to display different content or styles according to different conditions.For example, when the article list is empty, display 'No content', when an article is in the recommended state, add a 'HOT' mark, or add a special style to the first item in the loop.

2025-11-07

How to implement the pagination display function of AnQiCMS article list, as well as how to customize the pagination style and logic?

In content operation, the pagination display of the article list is a basic and crucial function, which not only affects the user's browsing experience, but also is closely related to the performance and SEO performance of the website.AnQiCMS as an efficient and customizable content management system provides us with a flexible way to implement and beautify the pagination function of the article list.

2025-11-07

How to get and display the title and link of the previous and next articles on the article detail page?

It is crucial to provide a smooth user experience in the operation of our website.When a visitor finishes reading a rich article, they often want to follow the trail and continue browsing other content in the same category or related topics.In this case, it is particularly important to display the titles and links of the previous and next articles on the article detail page.

2025-11-07

How to configure and display related article lists on the article detail page, and specify relevance rules (such as keywords or manual settings)?

How to make visitors easily find more related content after reading an excellent article on your website, continue to explore your website, which can not only significantly improve user experience, but also is a key strategy to optimize website SEO and reduce bounce rate.AnQiCMS (AnQiCMS) offers powerful and flexible features, allowing you to easily configure and display related article lists on the article detail page and specify relevance rules according to actual needs.Next, we will together learn how to achieve this goal in Anqi CMS.

2025-11-07

How to retrieve and display a list of articles under a specific category (or multiple categories) in AnQiCMS?

In AnQiCMS, flexibly displaying website content is the key to improving user experience and website functionality.No matter if you are running a corporate website, a personal blog, or a marketing site, you often encounter the need to display a list of the latest articles, popular products, or multiple related category content under a specific category on a particular page.AnQiCMS's powerful template tag system, especially the `archiveList` tag, can help you easily achieve this goal.

2025-11-07