Commit e0c294f6 authored by nirgendswo's avatar nirgendswo

change

parent 7ee1a70a
......@@ -2,15 +2,15 @@ composer.phar
/vendor/
/public/media/*
/public/files/*
/public/assets/*
/database/files/*
/resources/media/*
/resources/files/*
/resources/themes/*
!/database/files/.gitkeep
!/public/media/.gitkeep
!/resources/media/.gitkeep
!/public/files/.gitkeep
!/resources/files/.gitkeep
!/resources/themes/FuzzyCms
node_modules
......
......@@ -4,10 +4,13 @@ namespace App\Helpers;
use Illuminate\Support\Facades\Lang;
use Eventviva\ImageResize;
use Illuminate\Support\Facades\Log;
/**
* Helper for resizing and store images
*
* @TODO Find a better Wsy to create Path, use more Function, checkout for a shortcut for public directory
*
* @author Björn Hase
*/
class ImageHelper
......@@ -16,6 +19,10 @@ class ImageHelper
const UNDERSCORE = '_';
const REPLACE = '%s$1';
const FILE_NAMESPACE_WIDTH = 'width';
const FILE_NAMESPACE_HEIGHT = 'height';
const FILE_NAMESPACE_RELATIVE = 'relative';
/**
* pass through
*
......@@ -43,7 +50,7 @@ class ImageHelper
*/
public function scale($relativePath, $percentage)
{
$destinationPath = $this->getFilePathname($relativePath, 'relative_'.$percentage);
$destinationPath = $this->getFilePathname($relativePath, 'relative'.self::UNDERSCORE.$percentage);
$image = $this->has($destinationPath, $relativePath);
if ($image) {
......@@ -64,7 +71,7 @@ class ImageHelper
*/
public function resize($relativePath, $width, $height)
{
$destinationPath = $this->getFilePathname($relativePath, $width.'_'.$height);
$destinationPath = $this->getFilePathname($relativePath, $width.self::UNDERSCORE.$height);
$image = $this->has($destinationPath, $relativePath);
if ($image) {
......@@ -84,7 +91,7 @@ class ImageHelper
*/
public function resizeToHeight($relativePath, $height)
{
$destinationPath = $this->getFilePathname($relativePath, 'height_'.$height);
$destinationPath = $this->getFilePathname($relativePath, 'height'.self::UNDERSCORE.$height);
$image = $this->has($destinationPath, $relativePath);
if ($image) {
......@@ -104,7 +111,7 @@ class ImageHelper
*/
public function resizeToWidth($relativePath, $width)
{
$destinationPath = $this->getFilePathname($relativePath, 'width_'.$width);
$destinationPath = $this->getFilePathname($relativePath, 'width'.self::UNDERSCORE.$width);
$image = $this->has($destinationPath, $relativePath);
if ($image) {
......@@ -124,7 +131,7 @@ class ImageHelper
*/
protected function save($image, $filePathname)
{
$image->save(base_path().'/public/'.config('app.mediaPublicPath').'/'.$filePathname);
$image->save(base_path().'/public/'.config('app.filesPublicPath').'/'.$filePathname);
}
/**
......@@ -153,7 +160,7 @@ class ImageHelper
*/
protected function getPublicFilePathname($filePathname)
{
return '/'.config('app.mediaPublicPath').'/'.$filePathname;
return '/'.config('app.filesPublicPath').'/'.$filePathname;
}
/**
......@@ -168,9 +175,10 @@ class ImageHelper
$image = NULL;
// path to check if file exists
$exists = base_path().'/public/'.config('app.mediaPublicPath').'/'.$destinationPath;
if (!file_exists($exists)) {
$image = new ImageResize(base_path().'/'.config('app.mediaPath').'/'.$sourcePath);
$absoluteDestinationPath = base_path().'/public/'.config('app.filesPublicPath').'/'.$destinationPath;
if (!file_exists($absoluteDestinationPath)) {
$absoluteSourcePath = base_path().'/'.config('app.filesPath').'/'.$sourcePath;
$image = new ImageResize($absoluteSourcePath);
}
return $image;
......
......@@ -335,7 +335,7 @@ class PageRepository
if ($direction === self::ORDER_BY_ASC) {
if ($tempA > $tempB) {
$result = 0;
$result = 1;
}
} else if ($direction === self::ORDER_BY_DESC) {
if ($tempA < $tempB) {
......
<?php
return [
'filePath' => 'resources/files',
'filePublicPath' => 'files',
'filesPath' => 'resources/files',
'filesPublicPath' => 'files',
'repositoryPath' => 'database/files'
];
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment