forked from mejackreed/learn-iiif
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add basic implementation of image api playground
- Loading branch information
1 parent
4db4140
commit 05adade
Showing
13 changed files
with
224 additions
and
14 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
layout: page | ||
title: Image API Playground | ||
--- | ||
|
||
{% raw %} | ||
|
||
{scheme}://{server}{/prefix}/{identifier}/{region}/{size}/{rotation}/{quality}.{format} | ||
|
||
{% endraw %} | ||
|
||
<div id='image-api-playground'> </div> |
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.img-container { | ||
background: $gray; | ||
min-height: 400px; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ | |
@import '../../node_modules/bootstrap/scss/bootstrap'; | ||
|
||
@import 'application'; | ||
@import 'image_api_playground'; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
layout: page | ||
title: Image API | ||
permalink: /image-api/ | ||
--- | ||
|
||
The IIIF Image API is designed for standardization of requesting and delivering images on 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Img from 'react-image'; | ||
|
||
class ImageApiPlayground extends Component { | ||
constructor(props) { | ||
super(props); | ||
|
||
this.state = { | ||
region: '1015,1460,799,824', | ||
size: 'pct:25', | ||
rotation: '0', | ||
quality: 'default', | ||
format: 'jpg', | ||
}; | ||
|
||
this.handleChange = this.handleChange.bind(this); | ||
this.imageUrl = this.imageUrl.bind(this); | ||
} | ||
imageUrl() { | ||
return `${this.props.urlPrefix}/${this.state.region}/${this.state.size}/${this.state.rotation}/${this.state.quality}.${this.state.format}` | ||
} | ||
|
||
handleChange(event) { | ||
const newState = {}; | ||
newState[event.target.placeholder] = event.target.value; | ||
this.setState(newState); | ||
} | ||
|
||
|
||
render() { | ||
const image = this.imageUrl(); | ||
const spinner = (<img alt="spinner" className="" src='/assets/spinning-circles.svg'/>); | ||
return ( | ||
<div> | ||
<div className="row"> | ||
{this.props.urlPrefix}/ | ||
</div> | ||
<div className="row"> | ||
<div className="col-3"> | ||
<input | ||
type="text" | ||
className="form-control" | ||
placeholder="region" | ||
value={this.state.region} | ||
onChange={this.handleChange} | ||
|
||
/> | ||
</div> | ||
/ | ||
<div className="col-2"> | ||
<input | ||
type="text" | ||
className="form-control" | ||
placeholder="size" | ||
value={this.state.size} | ||
onChange={this.handleChange} | ||
|
||
/> | ||
</div> | ||
/ | ||
<div className="col-2"> | ||
<input | ||
type="text" | ||
className="form-control" | ||
placeholder="rotation" | ||
value={this.state.rotation} | ||
onChange={this.handleChange} | ||
|
||
/> | ||
</div> | ||
/ | ||
<div className="col-2"> | ||
<input | ||
type="text" | ||
className="form-control" | ||
placeholder="quality" | ||
value={this.state.quality} | ||
onChange={this.handleChange} | ||
|
||
/> | ||
</div> | ||
. | ||
<div className="col-2"> | ||
<input | ||
type="text" | ||
className="form-control" | ||
placeholder="format" | ||
value={this.state.format} | ||
onChange={this.handleChange} | ||
|
||
/> | ||
</div> | ||
</div> | ||
<div className="row p-4"> | ||
<div className="col-md-12 img-container rounded"> | ||
<div className="container d-flex h-100 justify-content-center"> | ||
<div className="row align-self-center"> | ||
<Img src={image} loader={spinner} className="p-4" /> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
// https://stacks.stanford.edu/image/iiif/hg676jb4964%2F0380_796-44/1015,1460,799,824/pct:25/0/default.jpg | ||
|
||
ImageApiPlayground.propTypes = { | ||
region: PropTypes.string, | ||
urlPrefix: PropTypes.string, | ||
} | ||
|
||
export default ImageApiPlayground; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,15 @@ | ||
console.log('holla') | ||
import React, { PureComponent } from 'react'; | ||
import { render } from 'react-dom'; | ||
import ImageApiPlayground from './components/ImageApiPlayground'; | ||
|
||
class App extends PureComponent { | ||
render() { | ||
return ( | ||
<ImageApiPlayground | ||
urlPrefix="https://stacks.stanford.edu/image/iiif/hg676jb4964%2F0380_796-44" | ||
/> | ||
); | ||
} | ||
} | ||
|
||
console.log('back') | ||
console.log('nextsdfkldsf') | ||
render(<App />, document.getElementById('image-api-playground')); |
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
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