Skip to content

Commit

Permalink
feat: file compress example
Browse files Browse the repository at this point in the history
  • Loading branch information
edysegura committed May 21, 2024
1 parent 1318f60 commit 4d7e207
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions image-compress/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,13 @@ pond.on('preparefile', (metadata, output) => {
console.log('File size before compression:', metadata.file.size)
console.log('File size after compression:', transformedOutput.file.size)
output.forEach((blob) => {
const img = new Image()
img.src = URL.createObjectURL(blob.file)
document.body.appendChild(img)
const figure = document.createElement('figure')
const image = document.createElement('img')
const figcaption = document.createElement('figcaption')
image.src = URL.createObjectURL(blob.file)
figcaption.textContent = `Size: ${blob.file.size} bytes`
figure.appendChild(image)
figure.appendChild(figcaption)
document.body.appendChild(figure)
})
})
Binary file added image-compress/big-image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4d7e207

Please sign in to comment.