Last active
December 21, 2021 11:32
-
-
Save AlRado/276c4be620d8edfec1e386455c0ecb17 to your computer and use it in GitHub Desktop.
Downloads and displays images from the WEB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": { | |
"dotnet_interactive": { | |
"language": "csharp" | |
} | |
}, | |
"outputs": [], | |
"source": [ | |
"using System.Collections.Generic;\n", | |
"using System.Linq;\n", | |
"using Microsoft.DotNet.Interactive;\n", | |
"using Microsoft.DotNet.Interactive.Formatting;\n", | |
"using static Microsoft.DotNet.Interactive.Formatting.PocketViewTags;\n", | |
"\n", | |
"void downloadAndShowImages(params string[] urls) {\n", | |
" display(span(urls.Select(url => \n", | |
" img[src:url, style:\"height:10em; padding: 4px\", title:\"Downloaded image\", alt: \"Loading error\"]))\n", | |
" );\n", | |
"}" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": { | |
"dotnet_interactive": { | |
"language": "csharp" | |
} | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/html": [ | |
"<span><img src=\"https://pixelartmaker-data-78746291193.nyc3.digitaloceanspaces.com/image/a4817c72e1e1d29.png\" style=\"height:100px; padding: 4px\" title=\"Downloaded image\" alt=\"Loading error\"></img></span>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"downloadAndShowImages(\"https://pixelartmaker-data-78746291193.nyc3.digitaloceanspaces.com/image/a4817c72e1e1d29.png\");" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": { | |
"dotnet_interactive": { | |
"language": "csharp" | |
} | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/html": [ | |
"<span><img src=\"https://zxart.ee/zxscreen/border:5/mode:mix/pal:srgb/type:standard/zoom:1/id:364506/\" style=\"height:100px; padding: 4px\" title=\"Downloaded image\" alt=\"Loading error\"></img><img src=\"https://zxart.ee/zxscreen/rotation:90/border:1/mode:mix/pal:srgb/type:standard/zoom:2/id:364819/\" style=\"height:100px; padding: 4px\" title=\"Downloaded image\" alt=\"Loading error\"></img><img src=\"https://zxart.ee/zxscreen/border:5/mode:mix/pal:srgb/type:standard/zoom:1/id:365068/\" style=\"height:100px; padding: 4px\" title=\"Downloaded image\" alt=\"Loading error\"></img><img src=\"https://zxart.ee/zxscreen/border:4/mode:mix/pal:srgb/type:standard/zoom:3/id:364542/\" style=\"height:100px; padding: 4px\" title=\"Downloaded image\" alt=\"Loading error\"></img><img src=\"https://zxart.ee/zxscreen/rotation:90/border:5/mode:mix/pal:srgb/type:standard/zoom:1/id:365658/\" style=\"height:100px; padding: 4px\" title=\"Downloaded image\" alt=\"Loading error\"></img></span>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"downloadAndShowImages(\n", | |
" new [] {\n", | |
" \"https://zxart.ee/zxscreen/border:5/mode:mix/pal:srgb/type:standard/zoom:1/id:364506/\",\n", | |
" \"https://zxart.ee/zxscreen/rotation:90/border:1/mode:mix/pal:srgb/type:standard/zoom:2/id:364819/\",\n", | |
" \"https://zxart.ee/zxscreen/border:5/mode:mix/pal:srgb/type:standard/zoom:1/id:365068/\",\n", | |
" \"https://zxart.ee/zxscreen/border:4/mode:mix/pal:srgb/type:standard/zoom:3/id:364542/\",\n", | |
" \"https://zxart.ee/zxscreen/rotation:90/border:5/mode:mix/pal:srgb/type:standard/zoom:1/id:365658/\",\n", | |
" }\n", | |
");" | |
] | |
} | |
], | |
"metadata": { | |
"interpreter": { | |
"hash": "a17440ef529219f80c0c11158b97dd17cc1c283d34abc79fc3eddfee85d20b70" | |
}, | |
"kernelspec": { | |
"display_name": ".NET (C#)", | |
"language": "C#", | |
"name": ".net-csharp" | |
}, | |
"language_info": { | |
"file_extension": ".cs", | |
"mimetype": "text/x-csharp", | |
"name": "C#", | |
"pygments_lexer": "csharp", | |
"version": "9.0" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment