informatique:javascript:resize_image
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| informatique:javascript:resize_image [13/07/2023 14:39] – créée cyrille | informatique:javascript:resize_image [13/07/2023 14:51] (Version actuelle) – cyrille | ||
|---|---|---|---|
| Ligne 8: | Ligne 8: | ||
| < | < | ||
| - | <script src=" | + | <script src=" |
| + | |||
| + | Sélectionner une image | ||
| + | <form accept=" | ||
| + | <input type=" | ||
| + | </ | ||
| + | < | ||
| + | <div id=" | ||
| + | |||
| + | < | ||
| + | document.getElementById(' | ||
| + | |||
| + | // file -> file | ||
| + | var b5 = Blitz.create() | ||
| + | |||
| + | b5({ | ||
| + | source: e.srcElement.files[0], | ||
| + | |||
| + | // image will be up or downscaled to always have minHeight of 600 | ||
| + | maxHeight: | ||
| + | maxWidth: | ||
| + | |||
| + | outputFormat: | ||
| + | output: ' | ||
| + | quality: | ||
| + | logPerformance: | ||
| + | }).then(download => { | ||
| + | console.log(' | ||
| + | // output is a download function. | ||
| + | |||
| + | // run some operations | ||
| + | |||
| + | // then call #download to download the file. | ||
| + | // | ||
| + | |||
| + | var image = new Image(); | ||
| + | image.src = download; | ||
| + | window.document.getElementById(' | ||
| + | |||
| + | }).catch(err => { | ||
| + | console.log(err) | ||
| + | }) | ||
| + | |||
| + | // | ||
| + | }; | ||
| + | </ | ||
| </ | </ | ||
informatique/javascript/resize_image.1689251986.txt.gz · Dernière modification : de cyrille
