Skip to content

Support full, remote URL for Images. #864

@vdhamer

Description

@vdhamer

Problem

The examples website states

Images can be either pictures from your /Assets/images folder, or one of the built-in icons.

I am in need of an option where the generated HTML images are simply loaded from a full, remote URL.

Why?

My static website is generated by software from a "database" (actually a bunch of version controlled JSON files). So one data source to my app is a set of full imageURLs. With Ignite, I currently need to move these to the /Assets/images folder. But I can get name clashes if two URLs have very different paths, but have the same filename: the HTML page will display 2 identical images because the first one got overwritten. Subdirectories within images/ could solve this, but gets messy because any component of the path may be essential.

Solution

Provide an extra variant of Image() that accepts a full URL. And generate the HTML to fetch that image simply using that full URL.

Discussion: if the link breaks because the host disappears of restructures, we won't see the desired image.
But for my application this is OK: the URL is not used to "borrow" someone else's image to embellish my site.
The other party is aware that their image is used, and actually has to select which image they want used. So they provide a full URL, and if it changes, they need to adapt the URL.

Short term workaround (for my own code)

I plan to append a suffix as soon as there is a filename clash: "myImage.jpg", "myImage_2.jpg, etc.
This approach is used more often (e.g. Import feature of Adobe Lightroom may find a name clash when adding images for a folder). It involves tracking the suffix (potentially empty string) in a dictionary while the site is generated. A bit more complicating than "HTML allows remove URLs, so you can provide a remote URL".

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions