Skip to content
Permalink
Browse files

remove imagecache and switch 2 glide cache route

  • Loading branch information
adr1enbe4udou1n committed Oct 20, 2018
1 parent d1001d9 commit 6ba04e8282c14018bb508df6a87b5207e7691e13
Showing with 2,196 additions and 2,400 deletions.
  1. +2 −0 .env.example
  2. +44 −0 app/Http/Controllers/ImageController.php
  3. +0 −14 app/Image/Templates/Large.php
  4. +0 −14 app/Image/Templates/Medium.php
  5. +0 −14 app/Image/Templates/Small.php
  6. +6 −16 app/Models/Post.php
  7. +4 −9 app/helpers.php
  8. +1 −2 composer.json
  9. +246 −423 composer.lock
  10. +5 −0 config/glide.php
  11. +0 −18 config/image.php
  12. +0 −71 config/imagecache.php
  13. +1,076 −0 public/dist/css/backend.de0a7eed3f161599ad6f.css
  14. +1 −0 public/dist/css/backend.de0a7eed3f161599ad6f.css.map
  15. +0 −1,076 public/dist/css/backend.e512402193832a71b0fa.css
  16. +0 −1 public/dist/css/backend.e512402193832a71b0fa.css.map
  17. +0 −321 public/dist/css/frontend.3e5d441e93e6904b6b2c.css
  18. +0 −1 public/dist/css/frontend.3e5d441e93e6904b6b2c.css.map
  19. +321 −0 public/dist/css/frontend.bff21c38ccdccf29b74b.css
  20. +1 −0 public/dist/css/frontend.bff21c38ccdccf29b74b.css.map
  21. +2 −0 public/dist/js/backend.de0a7eed3f161599ad6f.js
  22. +1 −0 public/dist/js/backend.de0a7eed3f161599ad6f.js.map
  23. +0 −2 public/dist/js/backend.e512402193832a71b0fa.js
  24. +0 −1 public/dist/js/backend.e512402193832a71b0fa.js.map
  25. +2 −2 public/dist/js/{frontend.3e5d441e93e6904b6b2c.js → frontend.bff21c38ccdccf29b74b.js}
  26. +1 −1 public/dist/js/{frontend.3e5d441e93e6904b6b2c.js.map → frontend.bff21c38ccdccf29b74b.js.map}
  27. +0 −1 public/dist/js/vendor-backend.2afa1092ce5a266bf362.js.map
  28. +7 −7 public/dist/js/{vendor-backend.2afa1092ce5a266bf362.js → vendor-backend.a32e9c39b2f83b6a9f33.js}
  29. +1 −0 public/dist/js/vendor-backend.a32e9c39b2f83b6a9f33.js.map
  30. +0 −1 public/dist/js/vendor-frontend.ce7e2a0b2001f516a079.js.map
  31. +9 −9 public/dist/js/{vendor-frontend.ce7e2a0b2001f516a079.js → vendor-frontend.d8ecf793b3c3e7a6faf6.js}
  32. +1 −0 public/dist/js/vendor-frontend.d8ecf793b3c3e7a6faf6.js.map
  33. +6 −6 public/dist/manifest-backend.json
  34. +8 −8 public/dist/manifest-frontend.json
  35. +2 −0 resources/js/backend/app.js
  36. +48 −0 resources/js/backend/components/Plugins/ImageStyle.vue
  37. +3 −3 resources/js/backend/views/PostForm.vue
  38. +6 −4 resources/js/backend/views/PostList.vue
  39. +5 −1 resources/views/frontend/blog/partials/published-posts.blade.php
  40. +3 −1 resources/views/frontend/blog/show.blade.php
  41. +1 −0 routes/web.php
  42. +0 −1 webpack.config.js
  43. +383 −372 yarn.lock
@@ -57,6 +57,8 @@ DEV_SERVER_URL=http://localhost:8080
NOCAPTCHA_SITEKEY=
NOCAPTCHA_SECRET=

GLIDE_KEY=

# Socialite Providers
#FACEBOOK_CLIENT_ID=
#FACEBOOK_CLIENT_SECRET=
@@ -0,0 +1,44 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use League\Glide\ServerFactory;
use League\Glide\Signatures\SignatureFactory;
use League\Glide\Signatures\SignatureException;
use League\Glide\Filesystem\FileNotFoundException;
use League\Glide\Responses\SymfonyResponseFactory;
class ImageController extends Controller
{
/**
* @param $path
* @param \Illuminate\Http\Request $request
*
* @return mixed
*/
public function show($path, Request $request)
{
try {
if (! auth()->check()) {
SignatureFactory::create(config('glide.key'))
->validateRequest('/img/'.$path, $request->all());
}
$path = str_replace('storage/', '', $path);
$server = ServerFactory::create([
'response' => new SymfonyResponseFactory($request),
'source' => storage_path('app/public'),
'cache' => storage_path('app/cache'),
'base_url' => 'img',
]);
return $server->getImageResponse($path, $request->all());
} catch (SignatureException $e) {
abort(403);
} catch (FileNotFoundException $e) {
abort(404);
}
}
}

This file was deleted.

This file was deleted.

This file was deleted.

@@ -37,8 +37,7 @@
* @property mixed $can_delete
* @property mixed $can_edit
* @property mixed $has_featured_image
* @property mixed $featured_image_path
* @property mixed $thumbnail_image_path
* @property mixed $featured_image_url
* @property mixed $meta_description
* @property mixed $meta_title
* @property mixed $published
@@ -120,8 +119,7 @@ class Post extends Model implements HasMedia
'state',
'status_label',
'has_featured_image',
'featured_image_path',
'thumbnail_image_path',
'featured_image_url',
'can_edit',
'can_delete',
];
@@ -221,22 +219,14 @@ public function getPublishedAttribute()
public function getHasFeaturedImageAttribute()
{
/* @var Media $media */
return (bool) $this->getMedia('featured image')->first();
return (bool) $this->getFirstMedia('featured image');
}
public function getFeaturedImagePathAttribute()
public function getFeaturedImageUrlAttribute()
{
/** @var Media $media */
if ($media = $this->getMedia('featured image')->first()) {
return str_replace(config('app.url'), '', $media->getUrl());
if ($image = $this->getFirstMedia('featured image')) {
return $image->getUrl();
}
return '/images/placeholder.png';
}
public function getThumbnailImagePathAttribute()
{
return image_template_url('small', $this->featured_image_path);
}
public function getMetaTitleAttribute()
@@ -1,6 +1,7 @@
<?php
use Illuminate\Database\Eloquent\Model;
use League\Glide\Urls\UrlBuilderFactory;
if (! function_exists('home_route')) {
/**
@@ -33,17 +34,11 @@ function is_admin_route(Illuminate\Http\Request $request)
}
if (! function_exists('image_template_url')) {
/**
* @param $template
* @param $imagePath
*
* @return string
*/
function image_template_url($template, $imagePath)
function image_template_url($path, array $params)
{
$imagePath = str_replace('/storage', '', $imagePath);
$urlBuilder = UrlBuilderFactory::create('/img/', config('glide.key'));
return url(config('imagecache.route')."/{$template}{$imagePath}");
return $urlBuilder->getUrl($path, $params);
}
}
@@ -14,15 +14,14 @@
"fideloper/proxy": "^4.0",
"guzzlehttp/guzzle": "^6.3",
"hieu-le/active": "^3.5",
"intervention/image": "^2.4",
"intervention/imagecache": "^2.3",
"laravel/framework": "5.7.*",
"laravel/scout": "^5.0",
"laravel/socialite": "^3.0",
"laravel/tinker": "^1.0",
"laravelcollective/html": "^5.7",
"laravelium/sitemap": "^3.0",
"league/csv": "^9.1",
"league/glide-symfony": "^1.0",
"maatwebsite/excel": "^3.0",
"martinlindhe/laravel-vue-i18n-generator": "^0.1.22",
"mcamara/laravel-localization": "^1.3",

0 comments on commit 6ba04e8

Please sign in to comment.
You can’t perform that action at this time.