PhiloBiblon / philobiblon-ui

PhiloBiblon UI
Creative Commons Attribution Share Alike 4.0 International
0 stars 0 forks source link

Show linked images #126

Open faulhaber opened 1 month ago

faulhaber commented 1 month ago

To test the problem of linked images, see: BETA manid 1110 (Madrid: Biblioteca Nacional de España, MSS/12793 V. 1) The link to the digital facsimile in the BNE is found in the INTERNET field BETA manid 1110 (pb.cog)

Based on issue#189

jmformenti commented 3 weeks ago

Try to find a new way to display images in PBUI, proposal:

  1. Check if the URL is a simple image, in that case display directly the image. Function to check if an url is an image:
    
    function isImageUrl(url) {
    return new Promise((resolve) => {
    const img = new Image();
    img.onload = () => resolve(true);
    img.onerror = () => resolve(false);
    img.src = url;
    });
    }

isImageUrl('https://example.com/image.jpg').then(isImage => { console.log(isImage); // true o false });


2. Otherwise, redirect to the URL.