Skip to content

Commit

Permalink
Fixing upload thumbnail.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidrushton committed Jun 27, 2017
1 parent f1be833 commit eb42b44
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/File.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php

namespace Origami\Upload;

Expand Down Expand Up @@ -67,12 +67,12 @@ public function isImage()

public function getThumbnail($size = 120)
{
$image = Intervention::make($this->getFilePath());
$image = Intervention::make($this->getFileContents());

$format = 'png';

$image->fit($size)->encode($format);

return 'data:image/'.$format.';base64,'.base64_encode($image);
}
}
}
10 changes: 6 additions & 4 deletions views/file.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
@else
<p class="current-file-name">{{ $file->getFilename() }}</p>
@endif
<label class="checkbox">
<input type="checkbox" name="{{ $name }}[delete]" value="true" /> Delete {{ $name }}
</label>
<div class="checkbox">
<label>
<input type="checkbox" name="{{ $name }}[delete]" value="true" /> Delete {{ $name }}
</label>
</div>
</div>
<p class="help-block">Upload a new file below or tick the box above to delete the current file.</p>
<input type="hidden" name="{{ $name }}[uploaded]" value="{{ $file->getFilename() }}" />
@endif
<input type="file" name="{{ $name }}[file]" />
<input type="file" name="{{ $name }}[file]" />

0 comments on commit eb42b44

Please sign in to comment.