mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
SVG support
This commit is contained in:
parent
586595e43c
commit
af52530b1d
@ -294,10 +294,17 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
||||
public function cover_image_update($adv)
|
||||
{
|
||||
if (count($adv->files) != 0) {
|
||||
$fileName = 'tn-' . $adv->files[0]->name;
|
||||
$fileName = $adv->files[0]->name;
|
||||
$ext = explode('.',$fileName);
|
||||
if ($ext[1] != 'svg') {
|
||||
$fileName = 'tn-' . $fileName;
|
||||
}
|
||||
|
||||
$folder = $this->folderRepository->findBySlug('images');
|
||||
$thumbnail = $this->fileRepository->findByNameAndFolder($fileName, $folder);
|
||||
if (!$thumbnail) {
|
||||
|
||||
if (!$thumbnail AND $ext[1] != 'svg') {
|
||||
|
||||
// Create thumbnail image
|
||||
$image = Image::make(file_get_contents($adv->files[0]->make()->url()));
|
||||
$image->resize(
|
||||
|
||||
@ -50,14 +50,20 @@ class UploadController extends AdminController
|
||||
|
||||
public function upload()
|
||||
{
|
||||
$mimes = explode('/', $this->request->file('upload')->getMimeType());
|
||||
|
||||
if ($mimes[0] == 'image') {
|
||||
$path = $_FILES['upload']['name'];
|
||||
$ext = pathinfo($path, PATHINFO_EXTENSION);
|
||||
if($ext == 'svg') {
|
||||
$mimes [0] = 'svg';
|
||||
$file = $this->uploader->upload($this->request->file('upload'), $this->folders->find($this->request->get('folder')));
|
||||
} else if ($doc_folder = app(FolderRepositoryInterface::class)->findBySlug('ads_documents')) {
|
||||
$file = $this->uploader->upload($this->request->file('upload'), $doc_folder);
|
||||
} else {
|
||||
return $this->response->json(['error' => trans('visiosoft.field_type.media::message.error_upload_docs')], 500);
|
||||
$mimes = explode('/', $this->request->file('upload')->getMimeType());
|
||||
if ($mimes[0] == 'image') {
|
||||
$file = $this->uploader->upload($this->request->file('upload'), $this->folders->find($this->request->get('folder')));
|
||||
} else if ($doc_folder = app(FolderRepositoryInterface::class)->findBySlug('ads_documents')) {
|
||||
$file = $this->uploader->upload($this->request->file('upload'), $doc_folder);
|
||||
} else {
|
||||
return $this->response->json(['error' => trans('visiosoft.field_type.media::message.error_upload_docs')], 500);
|
||||
}
|
||||
}
|
||||
|
||||
if ($file) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user