mirror of
https://github.com/kremalicious/blog.git
synced 2025-02-14 21:10:25 +01:00
makes exif readout work
This commit is contained in:
parent
b1632beea8
commit
7df57faa5f
@ -4,19 +4,52 @@ window.onload = getExif;
|
|||||||
|
|
||||||
function getExif() {
|
function getExif() {
|
||||||
const image = document.querySelector('.hentry__teaser img')
|
const image = document.querySelector('.hentry__teaser img')
|
||||||
const imageFileName = image.getAttribute('src').split('/').slice(-1)[0]
|
|
||||||
|
|
||||||
const img = new Image() // Create new img element
|
EXIF.getData(image, function () {
|
||||||
img.src = `/media/${imageFileName}`
|
// get individual data
|
||||||
img.addEventListener('load', function () {
|
const modelvalue = EXIF.getTag(this, 'Model')
|
||||||
EXIF.getData(img, function () {
|
const shutterspeedvalue = EXIF.getTag(this, 'ExposureTime')
|
||||||
var make = EXIF.getTag(this, 'Make')
|
const aperturevalue = EXIF.getTag(this, 'FNumber')
|
||||||
var model = EXIF.getTag(this, 'Model')
|
const exposurevalue = EXIF.getTag(this, 'ExposureBias')
|
||||||
var makeAndModel = document.querySelector('.exif__make')
|
const isovalue = EXIF.getTag(this, 'ISOSpeedRatings')
|
||||||
makeAndModel.innerHTML = `${make} ${model}`
|
const focallengthvalue = EXIF.getTag(this, 'FocalLength')
|
||||||
|
|
||||||
console.log(make)
|
// inject data
|
||||||
console.log(model)
|
if (modelvalue) {
|
||||||
})
|
const model = document.querySelector('.exif__model')
|
||||||
}, false)
|
model.innerHTML = modelvalue
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shutterspeedvalue) {
|
||||||
|
const shutterspeed = document.querySelector('.exif__shutterspeed')
|
||||||
|
shutterspeed.innerHTML = `${shutterspeedvalue.numerator}/${shutterspeedvalue.denominator}s`
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aperturevalue) {
|
||||||
|
const aperture = document.querySelector('.exif__aperture')
|
||||||
|
aperture.innerHTML = `ƒ ${aperturevalue}`
|
||||||
|
}
|
||||||
|
|
||||||
|
if (exposurevalue || exposurevalue === 0) {
|
||||||
|
const exposure = document.querySelector('.exif__exposure')
|
||||||
|
|
||||||
|
if (exposurevalue === 0) {
|
||||||
|
exposure.innerHTML = `+/- ${exposurevalue}`
|
||||||
|
} else if (exposurevalue > 0) {
|
||||||
|
exposure.innerHTML = `+ ${exposurevalue}`
|
||||||
|
} else {
|
||||||
|
exposure.innerHTML = `- ${exposurevalue}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isovalue) {
|
||||||
|
const iso = document.querySelector('.exif__iso')
|
||||||
|
iso.innerHTML = `ISO ${isovalue}`
|
||||||
|
}
|
||||||
|
|
||||||
|
if (focallengthvalue) {
|
||||||
|
const focallength = document.querySelector('.exif__focallength')
|
||||||
|
focallength.innerHTML = `${focallengthvalue}mm`
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
@extend .textcenter
|
@extend .textcenter
|
||||||
|
|
||||||
.entry-title
|
.entry-title
|
||||||
margin-top: -($spacer * 1.5)
|
margin-bottom: 0
|
||||||
|
|
||||||
figure
|
figure
|
||||||
position: relative
|
position: relative
|
||||||
@ -76,6 +76,21 @@
|
|||||||
&:active
|
&:active
|
||||||
background: none
|
background: none
|
||||||
|
|
||||||
|
//
|
||||||
|
// EXIF metadata display
|
||||||
|
//
|
||||||
|
.exif
|
||||||
|
@extend .small, .text-dimmed
|
||||||
|
text-align: left
|
||||||
|
position: absolute
|
||||||
|
bottom: -($spacer * 1.25)
|
||||||
|
left: $spacer
|
||||||
|
right: $spacer
|
||||||
|
|
||||||
|
.container
|
||||||
|
display: flex
|
||||||
|
flex-wrap: wrap
|
||||||
|
justify-content: space-between
|
||||||
|
|
||||||
//
|
//
|
||||||
// Photo background change adjustment
|
// Photo background change adjustment
|
||||||
|
@ -44,5 +44,5 @@
|
|||||||
//
|
//
|
||||||
.related-photos
|
.related-photos
|
||||||
@extend .divider-top
|
@extend .divider-top
|
||||||
margin-top: $spacer
|
margin-top: $spacer * 2
|
||||||
padding-top: $spacer
|
padding-top: $spacer * 3
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
padding: 0 ($spacer * 2)
|
padding: 0 ($spacer * 2)
|
||||||
|
|
||||||
.container
|
.container
|
||||||
max-width: 35em
|
max-width: 35rem
|
||||||
margin-left: auto
|
margin-left: auto
|
||||||
margin-right: auto
|
margin-right: auto
|
||||||
|
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
{% assign pictureSize = 'w_275,h_100,c_fill,q_auto:good,f_auto' %}
|
{% assign pictureSize = 'w_275,h_100,c_fill,q_auto:good,f_auto' %}
|
||||||
{% assign pictureSizeRetina = 'w_550,h_200,c_fill,q_auto:good,f_auto' %}
|
{% assign pictureSizeRetina = 'w_550,h_200,c_fill,q_auto:good,f_auto' %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% assign pictureSize = 'w_940,q_auto:best,f_auto' %}
|
{% assign pictureSize = 'w_940,f_auto,fl_keep_iptc' %}
|
||||||
{% assign pictureSizeRetina = 'w_1880,q_auto:best,f_auto' %}
|
{% assign pictureSizeRetina = 'w_1880,f_auto,fl_keep_iptc' %}
|
||||||
{% endcase %}
|
{% endcase %}
|
||||||
|
|
||||||
{% if include.file %}
|
{% if include.file %}
|
||||||
|
@ -16,11 +16,17 @@ js: photos.min.js
|
|||||||
|
|
||||||
{% include picture.html %}
|
{% include picture.html %}
|
||||||
|
|
||||||
</figure>
|
|
||||||
|
|
||||||
<aside class="exif">
|
<aside class="exif">
|
||||||
<div class="exif__make"></div>
|
<div class="container">
|
||||||
|
<span class="exif__model" title="Camera model"></span>
|
||||||
|
<span class="exif__aperture" title="Aperture"></span>
|
||||||
|
<span class="exif__shutterspeed" title="Shutter speed"></span>
|
||||||
|
<span class="exif__exposure" title="Exposure"></span>
|
||||||
|
<span class="exif__iso" title="ISO"></span>
|
||||||
|
<span class="exif__focallength" title="Focal length"></span>
|
||||||
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
|
</figure>
|
||||||
|
|
||||||
<section class="entry-content">
|
<section class="entry-content">
|
||||||
{{ content }}
|
{{ content }}
|
||||||
|
Loading…
Reference in New Issue
Block a user