#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:
Andy Heathershaw 2017-09-16 12:49:34 +01:00
parent 48f43b3c04
commit 88c687a3d1
6 changed files with 18 additions and 8 deletions

View File

@ -149,9 +149,11 @@ class PhotoController extends Controller
$photo = PhotoController::loadPhotoByAlbumAndFilename($album, $photoFilename);
$this->authorizeForUser($this->getUser(), 'changeMetadata', $photo);
$exifData = print_r(unserialize(base64_decode($photo->raw_exif_data)), true);
return Theme::render('gallery.photo_exif', [
'album' => $album,
'exif_data' => print_r(unserialize($photo->raw_exif_data), true),
'exif_data' => $exifData,
'photo' => $photo
]);
}

View File

@ -70,7 +70,12 @@ class PhotoService
// Read the Exif data
$exifData = @exif_read_data($photoFile);
$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;
// If Exif data contains an Orientation, ensure we rotate the original image as such

View File

@ -15,7 +15,7 @@ class AddPhotoExifDataColumn extends Migration
{
Schema::table('photos', function (Blueprint $table)
{
$table->longText('raw_exif_data');
$table->longText('raw_exif_data')->nullable(true);
});
}

View File

@ -16,6 +16,7 @@ return [
'edit_group' => 'Edit group',
'edit_storage' => 'Edit storage location',
'edit_user' => 'Edit user',
'exif_data' => 'Exif Data',
'groups' => 'Groups',
'home' => 'Gallery',
'labels' => 'Labels',

View File

@ -23,7 +23,7 @@
<form action="{{ route('albums.metadataPost', [$album->id]) }}" method="POST">
{{ csrf_field() }}
<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>
</div>
</pdiv>
@ -36,8 +36,9 @@
@push('scripts')
<script type="text/javascript">
$(document).ready(function() {
$('form').submit(function() {
$('button[type=submit]').prop('disabled', true);
$('#submit-button').click(function() {
$(this).prop('disabled', true);
$(this).closest('form').submit();
});
});
</script>

View File

@ -6,7 +6,8 @@
@foreach ($album->albumParentTree() as $parentAlbum)
<li class="breadcrumb-item"><a href="{{ $parentAlbum->url() }}">{{ $parentAlbum->name }}</a></li>
@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
@section('content')
@ -24,7 +25,7 @@
<div class="col content-body">
<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>