Unlisted
Edited
Feb 21, 2023
Fork of The Story
Insert cell
Insert cell
Insert cell
import {select} from "@jashkenas/inputs"
Insert cell
Insert cell
myFilesArray = Array.from(myFiles.keys());
Insert cell
Insert cell
selection.image( {width: 120} )
Insert cell
files23 = [
FileAttachment("2.png"),
FileAttachment("3.png"),
].reduce((o, f) => (o[f.name] = f, o), {})
Insert cell
html`<img src="${await files23["2.png"]}" style="height: 100px">`
Insert cell
Insert cell
html`<img src="${await storyImages[0].url}" style="height: 100px">`
Insert cell
Insert cell
<DIV id=i2>`${await storyImages[0].img}` </DIV>
Insert cell
<DIV id="i0"> </DIV>
Insert cell
d3 = require("d3-selection")
Insert cell
adjust = function adjust() {
const i0 = storyImages[0];
const width = 50;
var imgDiv = document.getElementById("i0");
d3.select(imgDiv).selectAll("img").remove();
d3.select(imgDiv)
.append("img")
.attr("width", width)
.attr("src", i0.url);
return 0;
}
Insert cell
Insert cell
storyImages[0];
Insert cell
getsmallImage = function getSmallImage() {
const i0 = (await storyImages[0].img).json();

const str = htl.html`${storyImages[0].img}`;

myCell.append(str);
document.getElementById("i0").innerHTML = str;

// document.getElementById("i0").innerHTML= '<img src=" + h0 + ">';
// document.getElementById("i0").innerHTML = '<img src=" + str + "/>';
// document.getElementById("i0").innerHTML = "hhh";
// document.getElementById("i0").innerHTML = '<img src=" +'<img src=" +`${await storyImages[0].url}` + "/>';

// document.getElementById("i0").width = "300";
return str;
}
Insert cell
dog = (await fetch(`https://dog.ceo/api/breeds/image/random`)).json()
Insert cell
FileAttachment("1.jpeg").image( {width: 100})
Insert cell
{
const str=keys[0];
FileAttachment(`str`).image();
}
Insert cell
<DIV id=i3>`${await vals[0]}` </DIV>
Insert cell
vals = [...files.values()];
Insert cell
keys = [...files.keys()];
Insert cell
files = {
const src = await (await fetch(moduleURL)).text();
const match = src.match(/\n\s+const fileAttachments = (new Map\(\[.+?);\n/s);
return match ? eval(match[1]) : new Map;
}
Insert cell
viewof notebook = notebookInput({value: '@observablehq/file-attachments'})
Insert cell
harcodedNotebook ='@observablehq/file-attachments'
Insert cell
moduleURL = notebook.module
// moduleURL = "@observablehq/d/2e92305f303bfe6c.js"
Insert cell
import {notebookInput} from '@mootari/notebook-input'
Insert cell
FileAttachment("1.jpeg").image()
Insert cell
Insert cell
untitled13 = FileAttachment("14.png").image()
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more