GithubHelp home page GithubHelp logo

Comments (3)

redoPop avatar redoPop commented on September 26, 2024 1

I understand your request now. This isn't something I'd add to Loupe itself, but the image method could be overridden to perform the decoding or to return a value decoded elsewhere, e.g.:

const loupe = new Loupe(document.getElementById('demo-1'));
const url = atob(loupe.el.getAttribute('data-enc'));
loupe.image = () => url;

from loupe.

redoPop avatar redoPop commented on September 26, 2024

Hi! Based on your example, you should be able to use the data URI scheme to accomplish this; e.g.:

<img src="data:<?php echo mime_content_type('big.jpg'); ?>;base64,<?php echo base64_encode(file_get_contents('big.jpg')); ?>" />

Because Loupe uses CSS background images, a data URI will work just as well for an <a href="…"> scenario as it would for an <img src="…"> scenario.

Does that help you?

from loupe.

crisc2000 avatar crisc2000 commented on September 26, 2024

I never tried to encode a 20Mpx image but I think cpu usage increase will be big for both server and client, usually this type of encode is used for small images like icons. I only suggested to accept base64 encoded file name/path, not to convert all the file to data:base64.
It's just a suggestion, maybe some other people will want to not reveal the path to the big size image.

from loupe.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.