D
Deno

help

How to import the Image class to Deno Fresh?

PPoncho10/5/2022
I'm trying to access an image's naturalHeight and naturalWidth. But when I construct the object new Image() I get a Reference Error that it is not defined. I figured I could import it from a preact module or something similar to (import {Image} from 'preact/image), but I simply couldn't find out from which module to import it.
ABTAndreu Botella (they/them)10/5/2022
Image is a class that exists in the browser but not in Deno the browser obviously knows how to parse and render images, because it has to, but Deno doesn't I don't think there's a polyfill that you could import but depending on the image formats you need, there might be libraries that might do that with a different API
PPoncho10/5/2022
Thank you for your answer. I understand your point, I was trying to do this inside of an Island with the hopes that the Image would be constructed on the client. As you pointed out, the module imagescript is exactly what I was looking for.

Looking for more? Join the community!

Recommended Posts
sub sub domain on deno.devIs it possible to create a sub sub domain with deno.dev, example, invite.my-bot.deno.dev, support.myhow to cli run node modules without --compatSo `deno run --compat` has now been removed in favor of `npm:` specifiers https://deno.com/blog/v1.2Intellisense on an import not working, works for friendI cannot for the life of me get `import * as bsdeno from "https://raw.githubusercontent.com/KivalEvaHow to create a broadcast system with streams and oak?i'm trying to create a simple "web-radio" to learn more about streams with deno and oak. i'm stuck oDeno.serveTls with self signed certificatei try to create a webserver but i cannot use self signed certificates, how can i solve this ? ```jReadableStream to JSONi cant seem to get a JSON out of the request.body i attached pictures for the front end JS request cdistinguis `netERR_CONNECTION_TIMED_OUT` from `netERR_CERT_AUTHORITY_INVALID`i get `net::ERR_CERT_AUTHORITY_INVALID` because i use self signed certs on the domain `localhost` nCommand doesn't work in deno task but works outside of deno taskThe command in question: ```(find . -name '*.js'; find . -name '*.as') | grep -v bundle | xargs wc -How do I patch a std api?Hello. This person posted in this command that they "patched" the `vm.isContext` function to returnMonkey patch Broadcast Channel to send messages to current contextEssentially what I want to do is be able to connect to `new BroadcastChannel("test_channel");` whichDynamically imported module evaluation is still pendingI'm very confused on the error i put as the title because in my program i'm trying to just import soHow to setup CORS with serve? I get 403 forbidden.I've setup the following headers (OPTIONS response): ``` new Response(null, { status: 204, heade