Add image viewing in blog entries
This commit is contained in:
parent
7a8fb3449d
commit
a0f93ae9c3
5 changed files with 55 additions and 5 deletions
|
|
@ -132,4 +132,4 @@ The code is not yet complete and in the future I would like to test for more:
|
||||||
* RNN : which was the trigger that started all of this
|
* RNN : which was the trigger that started all of this
|
||||||
* Data transfert? (CPU->GPU and GPU->CPU)
|
* Data transfert? (CPU->GPU and GPU->CPU)
|
||||||
|
|
||||||
If you have questions or remarks you can contact me or reply the [reddit post]() (TO BE INSERTED).
|
If you have questions or remarks you can contact me or reply the [reddit post](https://www.reddit.com/r/MachineLearning/comments/q2y9n5/d_deep_learning_framework_benchmark/).
|
||||||
|
|
@ -29,12 +29,30 @@ class BlogEntryComponent extends Component
|
||||||
|
|
||||||
render()
|
render()
|
||||||
{
|
{
|
||||||
return (
|
return [
|
||||||
<div className="blog-entry"
|
<div className="blog-entry"
|
||||||
dangerouslySetInnerHTML={this.props.blog_entry_name === this.entry_name ?
|
dangerouslySetInnerHTML={this.props.blog_entry_name === this.entry_name ?
|
||||||
{__html: this.props.blog_entry} : null}>
|
{__html: this.props.blog_entry} : null}>
|
||||||
</div>
|
</div>,
|
||||||
)
|
<div id="image-container" onclick={() => close_image()}>
|
||||||
|
<img id="image-view"/>
|
||||||
|
</div>,
|
||||||
|
<script>
|
||||||
|
{`const container = document.getElementById("image-container")
|
||||||
|
const image_view = document.getElementById("image-view")
|
||||||
|
|
||||||
|
function open_image(src)
|
||||||
|
{
|
||||||
|
image_view.src = src
|
||||||
|
container.style.display = 'flex'
|
||||||
|
}
|
||||||
|
|
||||||
|
function close_image()
|
||||||
|
{
|
||||||
|
container.style.display = 'none'
|
||||||
|
}`}
|
||||||
|
</script>
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,25 @@
|
||||||
margin: 0 10px;
|
margin: 0 10px;
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#image-container
|
||||||
|
{
|
||||||
|
position: fixed;
|
||||||
|
display: none;
|
||||||
|
background-color: rgba(0, 0, 0, 0.8);
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#image-view
|
||||||
|
{
|
||||||
|
height: 90vh;
|
||||||
}
|
}
|
||||||
13
src/test.js
Normal file
13
src/test.js
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
const container = document.getElementById("image-container")
|
||||||
|
const image_view = document.getElementById("image-view")
|
||||||
|
|
||||||
|
function view_image(src)
|
||||||
|
{
|
||||||
|
image_view.src = src
|
||||||
|
container.style.display = 'flex'
|
||||||
|
}
|
||||||
|
|
||||||
|
function close_image()
|
||||||
|
{
|
||||||
|
container.style.display = 'none'
|
||||||
|
}
|
||||||
|
|
@ -36,7 +36,7 @@ renderer.image = (href, title, text) => {
|
||||||
{
|
{
|
||||||
out += ' title="' + text + '"';
|
out += ' title="' + text + '"';
|
||||||
}
|
}
|
||||||
out += '/>';
|
out += ' onclick="open_image(\'' + href + '\')" />';
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue