Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Tenzing
/
pdf-customizer
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
b1d6beab
authored
2016-04-19 13:44:32 -0400
by
Jeff Balicki
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fited config
1 parent
51a54f58
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
6 deletions
app/Http/Controllers/ApiController.php
app/Http/Controllers/PdfController.php
config/app.php
app/Http/Controllers/ApiController.php
View file @
b1d6bea
...
...
@@ -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
);
...
...
app/Http/Controllers/PdfController.php
View file @
b1d6bea
...
...
@@ -15,7 +15,7 @@ use Illuminate\Support\Facades\Input;
use
Intervention\Image\Facades\Image
;
use
Illuminate\Support\Facades\Facade
;
use
League\Flysystem\Filesystem
;
use
pdf
lib
;
use
PDF
lib
;
...
...
@@ -38,7 +38,7 @@ class PdfController extends Controller
try
{
$p
=
new
pdf
lib
();
$p
=
new
PDF
lib
();
$p
->
set_option
(
"SearchPath={{"
.
$searchpath
.
"}}"
);
...
...
config/app.php
View file @
b1d6bea
...
...
@@ -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
],
...
...
Please
register
or
sign in
to post a comment