#38, #39: EXIF data is now stored base64-encoded in the database to prevent issues with raw characters coming off some cameras. EXIF data is no longer replaced on analysis - allowing rotated images to maintain the data.
This commit is contained in:
parent
48f43b3c04
commit
88c687a3d1
@ -149,9 +149,11 @@ class PhotoController extends Controller
|
|||||||
$photo = PhotoController::loadPhotoByAlbumAndFilename($album, $photoFilename);
|
$photo = PhotoController::loadPhotoByAlbumAndFilename($album, $photoFilename);
|
||||||
$this->authorizeForUser($this->getUser(), 'changeMetadata', $photo);
|
$this->authorizeForUser($this->getUser(), 'changeMetadata', $photo);
|
||||||
|
|
||||||
|
$exifData = print_r(unserialize(base64_decode($photo->raw_exif_data)), true);
|
||||||
|
|
||||||
return Theme::render('gallery.photo_exif', [
|
return Theme::render('gallery.photo_exif', [
|
||||||
'album' => $album,
|
'album' => $album,
|
||||||
'exif_data' => print_r(unserialize($photo->raw_exif_data), true),
|
'exif_data' => $exifData,
|
||||||
'photo' => $photo
|
'photo' => $photo
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,12 @@ class PhotoService
|
|||||||
// Read the Exif data
|
// Read the Exif data
|
||||||
$exifData = @exif_read_data($photoFile);
|
$exifData = @exif_read_data($photoFile);
|
||||||
$isExifDataFound = ($exifData !== false && is_array($exifData));
|
$isExifDataFound = ($exifData !== false && is_array($exifData));
|
||||||
$this->photo->raw_exif_data = $isExifDataFound ? serialize($exifData) : '';
|
|
||||||
|
if (is_null($this->photo->raw_exif_data))
|
||||||
|
{
|
||||||
|
$this->photo->raw_exif_data = $isExifDataFound ? base64_encode(serialize($exifData)) : '';
|
||||||
|
}
|
||||||
|
|
||||||
$angleToRotate = 0;
|
$angleToRotate = 0;
|
||||||
|
|
||||||
// If Exif data contains an Orientation, ensure we rotate the original image as such
|
// If Exif data contains an Orientation, ensure we rotate the original image as such
|
||||||
|
@ -15,7 +15,7 @@ class AddPhotoExifDataColumn extends Migration
|
|||||||
{
|
{
|
||||||
Schema::table('photos', function (Blueprint $table)
|
Schema::table('photos', function (Blueprint $table)
|
||||||
{
|
{
|
||||||
$table->longText('raw_exif_data');
|
$table->longText('raw_exif_data')->nullable(true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ return [
|
|||||||
'edit_group' => 'Edit group',
|
'edit_group' => 'Edit group',
|
||||||
'edit_storage' => 'Edit storage location',
|
'edit_storage' => 'Edit storage location',
|
||||||
'edit_user' => 'Edit user',
|
'edit_user' => 'Edit user',
|
||||||
|
'exif_data' => 'Exif Data',
|
||||||
'groups' => 'Groups',
|
'groups' => 'Groups',
|
||||||
'home' => 'Gallery',
|
'home' => 'Gallery',
|
||||||
'labels' => 'Labels',
|
'labels' => 'Labels',
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
<form action="{{ route('albums.metadataPost', [$album->id]) }}" method="POST">
|
<form action="{{ route('albums.metadataPost', [$album->id]) }}" method="POST">
|
||||||
{{ csrf_field() }}
|
{{ csrf_field() }}
|
||||||
<a href="{{ route('admin.metadataUpgrade', ['id' => $album->id]) }}" class="btn btn-link">@lang('forms.cancel_action')</a>
|
<a href="{{ route('admin.metadataUpgrade', ['id' => $album->id]) }}" class="btn btn-link">@lang('forms.cancel_action')</a>
|
||||||
<button type="submit" class="btn btn-primary"><i class="fa fa-fw fa-check"></i> @lang('forms.continue_action')</button>
|
<button id="submit-button" type="submit" class="btn btn-primary"><i class="fa fa-fw fa-check"></i> @lang('forms.continue_action')</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</pdiv>
|
</pdiv>
|
||||||
@ -36,8 +36,9 @@
|
|||||||
@push('scripts')
|
@push('scripts')
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('form').submit(function() {
|
$('#submit-button').click(function() {
|
||||||
$('button[type=submit]').prop('disabled', true);
|
$(this).prop('disabled', true);
|
||||||
|
$(this).closest('form').submit();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
@foreach ($album->albumParentTree() as $parentAlbum)
|
@foreach ($album->albumParentTree() as $parentAlbum)
|
||||||
<li class="breadcrumb-item"><a href="{{ $parentAlbum->url() }}">{{ $parentAlbum->name }}</a></li>
|
<li class="breadcrumb-item"><a href="{{ $parentAlbum->url() }}">{{ $parentAlbum->name }}</a></li>
|
||||||
@endforeach
|
@endforeach
|
||||||
<li class="breadcrumb-item active">{{ $photo->name }}</li>
|
<li class="breadcrumb-item"><a href="{{ $photo->url() }}">{{ $photo->name }}</a></li>
|
||||||
|
<li class="breadcrumb-item active">@lang('navigation.breadcrumb.exif_data')</li>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
@ -24,7 +25,7 @@
|
|||||||
<div class="col content-body">
|
<div class="col content-body">
|
||||||
<p class="text-center"><img src="{{ $photo->thumbnailUrl('fullsize') }}" alt="" class="img-thumbnail mb-4"/></p>
|
<p class="text-center"><img src="{{ $photo->thumbnailUrl('fullsize') }}" alt="" class="img-thumbnail mb-4"/></p>
|
||||||
|
|
||||||
<pre>{{ $exif_data }}</pre>
|
<pre>{!! $exif_data !!}</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user