Add preview and usage counter to blogs uploads

Created:
Last Update:

Author: Christoph Stoettner
Read in about 2 min · 366 words

Camera Viewfinder

Photo by Glenn Carstens-Peters | Unsplash

I received several complaints from users who struggle to identify uploaded images in the File Uploads section of blogs. This happens because pasted images get cryptic filenames like editor_image_ + UUID, making it challenging to identify and delete unused images.

Blogs upload view

To solve this problem, I used the customizer to load additional JavaScript that adds more information to this view, helping users make informed decisions about which images can be safely deleted.

JSON to import in customizer

{
    "name": "Blog File Uploads",
    "title": "Add preview and counter to Blog File Uploads",
    "description": "Adding a bit more value for users to Blogs File Uploads",
    "services": [
        "Connections",
        "Customizer"
    ],
    "state": "enabled",
    "extensions": [
        {
            "name": "Blogs",
            "type": "com.ibm.customizer.ui",
            "payload": {
                "include-files": [
                    "stoeps-customizer-css/blog-upload-preview.js",
                    "stoeps-customizer-css/blog-upload.css"
                ],
                "match": {
                    "url": "roller-ui/authoring/uploadFiles.do"
                },
                "cache-headers": {
                    "cache-control": "max-age=0"
                }
            },
            "path": "blogs",
            "state": "enabled"
        }
    ]
}

There is a very good article on the different options of Customizer payloads. I used it to find the "match":{"url": "roller-ui/..."} option to include the JavaScript and CSS only for the upload URL.

Installation Files

Download these files and copy them to the customizer NFS share (/pv-connections/customizer) in the folder stoeps-customizer-css (or adjust paths in the customizer app):

How It Works

After injecting blog-upload-preview.js, a new button appears that lets users add a preview column to the images and displays a counter showing how often each image is used within the blog.

Blogs upload view with the new button to toggle count and preview

When you click the button, the view transforms:

View of uploaded blog images with added count and preview, sorted by usage count

You can view any image at its full size by clicking on it. The enlarged view closes when you click anywhere outside the image.

Overlay display showing image at original size

With this enhancement, you can easily identify unused images and directly select them for deletion, making blog maintenance significantly easier.

Comments
Error
There was an error sending your comment, please try again.
Thank you!
Your comment has been submitted and will be published once it has been approved.
Success!
Your comment has been posted successfully.

Comments

Loading comments...

Leave a Comment

Your email address will not be published. Required fields are marked with *

Suggested Reading
Card image cap

Today I read the article KB0118248 and remembered my blog post from 2018 . I also checked the attached aha idea where a comment states that you can use iframe for Youtube. Despite what KB0118248 incorrectly states, it is absolutely possible to embed videos in HCL Connections blogs and wikis using the HTML video tag as demonstrated in this post.

Created:
Last Update:
Read in about 2 min
Card image cap

I created a git repository with some smaller CSS files to fix some annoyances within HCL Connections.

I started with this to prevent Orient Me to load fonts from external URLs or Elasticsearch Metrics to break the UI on larger screens. These issues are solved after the last updates I got from support, but Blogs and Tailored Experience Wizard can be improved with some simple rules.

Created: Read in about 3 min
Card image cap

Last week I attended Social Connections 14 in Berlin, the event location had a great view and weather was great.

Created:
Last Update:
Read in about 1 min