Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Platform
Commits
8b5b2713
Commit
8b5b2713
authored
Oct 30, 2014
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refacoring and adding direct getter
parent
51ea1b55
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
10 deletions
+33
-10
MediaController.php
Http/Controllers/Admin/MediaController.php
+2
-1
Imagy.php
Image/Imagy.php
+31
-9
No files found.
Http/Controllers/Admin/MediaController.php
View file @
8b5b2713
...
...
@@ -73,7 +73,8 @@ class MediaController extends AdminBaseController
*/
public
function
edit
(
File
$file
)
{
dd
(
$this
->
imagy
->
get
(
'/assets/media/screen-shot-2014-10-25-at-44939-pm.png'
,
'smallThumb'
,
true
));
//dd($this->imagy->get('/assets/media/screen-shot-2014-10-25-at-44939-pm.png', 'smallThumb', true));
//dd($this->imagy->getThumbnail('/assets/media/screen-shot-2014-10-25-at-44939-pm.png', 'smallThumb'));
return
View
::
make
(
'media::admin.edit'
,
compact
(
'file'
));
}
...
...
Image/Imagy.php
View file @
8b5b2713
...
...
@@ -45,19 +45,22 @@ class Imagy
return
$filename
;
}
$image
=
$this
->
image
->
make
(
public_path
()
.
$path
);
foreach
(
$this
->
config
->
get
(
"media::thumbnails.
{
$thumbnail
}
"
)
as
$manipulation
=>
$options
)
{
$image
=
$this
->
imageFactory
->
make
(
$manipulation
)
->
handle
(
$image
,
$options
);
}
$image
=
$image
->
encode
(
pathinfo
(
$path
,
PATHINFO_EXTENSION
));
$this
->
writeImage
(
$filename
,
$image
);
$this
->
makeNew
(
$path
,
$thumbnail
,
$filename
);
return
$filename
;
}
/**
* Return the thumbnail path
* @param string $originalImage
* @param string $thumbnail
* @return string
*/
public
function
getThumbnail
(
$originalImage
,
$thumbnail
)
{
return
'/assets/media/'
.
$this
->
newFilename
(
$originalImage
,
$thumbnail
);
}
/**
* Prepend the thumbnail name to filename
* @param $path
...
...
@@ -91,4 +94,23 @@ class Imagy
{
$this
->
finder
->
put
(
public_path
()
.
$filename
,
$image
);
}
/**
* Make a new image
* @param string $path
* @param string $thumbnail
* @param string $filename
*/
private
function
makeNew
(
$path
,
$thumbnail
,
$filename
)
{
$image
=
$this
->
image
->
make
(
public_path
()
.
$path
);
foreach
(
$this
->
config
->
get
(
"media::thumbnails.
{
$thumbnail
}
"
)
as
$manipulation
=>
$options
)
{
$image
=
$this
->
imageFactory
->
make
(
$manipulation
)
->
handle
(
$image
,
$options
);
}
$image
=
$image
->
encode
(
pathinfo
(
$path
,
PATHINFO_EXTENSION
));
$this
->
writeImage
(
$filename
,
$image
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment