b1d6beab by Jeff Balicki

fited config

1 parent 51a54f58
...@@ -42,11 +42,13 @@ class ApiController extends Controller ...@@ -42,11 +42,13 @@ class ApiController extends Controller
42 42
43 43
44 $storagePath = Storage::disk('local')->getDriver()->getAdapter()->getPathPrefix(); 44 $storagePath = Storage::disk('local')->getDriver()->getAdapter()->getPathPrefix();
45 $folder = str_replace(' ', '-', $json->pdf[0]->label); // Replaces all spaces with hyphens. 45 $folder = str_replace(' ', '-', $json->pdf[0]->name); // Replaces all spaces with hyphens.
46 $folder = preg_replace('/[^A-Za-z0-9\-]/', '', $folder); 46 $folder = preg_replace('/[^A-Za-z0-9\-]/', '', $folder);
47 47
48 if(!is_dir($storagePath . $folder . '/')){ 48 if(!is_dir($storagePath . $folder . '/')){
49 mkdir($storagePath . $folder . '/'); 49 $old = umask(0);
50 mkdir($storagePath . $folder . '/', 0777);
51 umask($old);
50 } 52 }
51 53
52 if (isset($json->pdf[0]->pdfLocation)) { 54 if (isset($json->pdf[0]->pdfLocation)) {
...@@ -58,6 +60,10 @@ class ApiController extends Controller ...@@ -58,6 +60,10 @@ class ApiController extends Controller
58 $curl->close(); 60 $curl->close();
59 $im = new Imagick(); 61 $im = new Imagick();
60 $im->setResolution(300, 300); //set the resolution of the resulting jpg 62 $im->setResolution(300, 300); //set the resolution of the resulting jpg
63 if (! is_readable($storagePath . $folder . '/' . end($file))) {
64 echo 'file not readable';
65 exit();
66 }
61 $im->readImage($storagePath . $folder . '/' . end($file)); //[0] for the first page 67 $im->readImage($storagePath . $folder . '/' . end($file)); //[0] for the first page
62 $im->setImageFormat('jpg'); 68 $im->setImageFormat('jpg');
63 $fileName = end($file); 69 $fileName = end($file);
......
...@@ -15,7 +15,7 @@ use Illuminate\Support\Facades\Input; ...@@ -15,7 +15,7 @@ use Illuminate\Support\Facades\Input;
15 use Intervention\Image\Facades\Image; 15 use Intervention\Image\Facades\Image;
16 use Illuminate\Support\Facades\Facade; 16 use Illuminate\Support\Facades\Facade;
17 use League\Flysystem\Filesystem; 17 use League\Flysystem\Filesystem;
18 use pdflib; 18 use PDFlib;
19 19
20 20
21 21
...@@ -38,7 +38,7 @@ class PdfController extends Controller ...@@ -38,7 +38,7 @@ class PdfController extends Controller
38 38
39 try { 39 try {
40 40
41 $p = new pdflib(); 41 $p = new PDFlib();
42 42
43 43
44 $p->set_option("SearchPath={{" . $searchpath . "}}"); 44 $p->set_option("SearchPath={{" . $searchpath . "}}");
......
...@@ -147,7 +147,7 @@ return [ ...@@ -147,7 +147,7 @@ return [
147 Illuminate\Translation\TranslationServiceProvider::class, 147 Illuminate\Translation\TranslationServiceProvider::class,
148 Illuminate\Validation\ValidationServiceProvider::class, 148 Illuminate\Validation\ValidationServiceProvider::class,
149 Illuminate\View\ViewServiceProvider::class, 149 Illuminate\View\ViewServiceProvider::class,
150 Vsmoraes\Pdf\PdfServiceProvider::class, 150
151 151
152 /* 152 /*
153 * Application Service Providers... 153 * Application Service Providers...
...@@ -202,7 +202,7 @@ return [ ...@@ -202,7 +202,7 @@ return [
202 'URL' => Illuminate\Support\Facades\URL::class, 202 'URL' => Illuminate\Support\Facades\URL::class,
203 'Validator' => Illuminate\Support\Facades\Validator::class, 203 'Validator' => Illuminate\Support\Facades\Validator::class,
204 'View' => Illuminate\Support\Facades\View::class, 204 'View' => Illuminate\Support\Facades\View::class,
205 'PDF' => Vsmoraes\Pdf\PdfFacade::class 205
206 206
207 207
208 ], 208 ],
......