b1d6beab by Jeff Balicki

fited config

1 parent 51a54f58
......@@ -42,11 +42,13 @@ class ApiController extends Controller
$storagePath = Storage::disk('local')->getDriver()->getAdapter()->getPathPrefix();
$folder = str_replace(' ', '-', $json->pdf[0]->label); // Replaces all spaces with hyphens.
$folder = str_replace(' ', '-', $json->pdf[0]->name); // Replaces all spaces with hyphens.
$folder = preg_replace('/[^A-Za-z0-9\-]/', '', $folder);
if(!is_dir($storagePath . $folder . '/')){
mkdir($storagePath . $folder . '/');
$old = umask(0);
mkdir($storagePath . $folder . '/', 0777);
umask($old);
}
if (isset($json->pdf[0]->pdfLocation)) {
......@@ -58,6 +60,10 @@ class ApiController extends Controller
$curl->close();
$im = new Imagick();
$im->setResolution(300, 300); //set the resolution of the resulting jpg
if (! is_readable($storagePath . $folder . '/' . end($file))) {
echo 'file not readable';
exit();
}
$im->readImage($storagePath . $folder . '/' . end($file)); //[0] for the first page
$im->setImageFormat('jpg');
$fileName = end($file);
......
......@@ -15,7 +15,7 @@ use Illuminate\Support\Facades\Input;
use Intervention\Image\Facades\Image;
use Illuminate\Support\Facades\Facade;
use League\Flysystem\Filesystem;
use pdflib;
use PDFlib;
......@@ -38,7 +38,7 @@ class PdfController extends Controller
try {
$p = new pdflib();
$p = new PDFlib();
$p->set_option("SearchPath={{" . $searchpath . "}}");
......
......@@ -147,7 +147,7 @@ return [
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
Vsmoraes\Pdf\PdfServiceProvider::class,
/*
* Application Service Providers...
......@@ -202,7 +202,7 @@ return [
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
'PDF' => Vsmoraes\Pdf\PdfFacade::class
],
......