Browse Source

added effects to front; resize image before applying effect

develop
Robin Thoni 8 years ago
parent
commit
d9dea72a9d

+ 2
- 0
app/Http/Business/EffectsBusiness.php View File

@@ -27,6 +27,8 @@ class EffectsBusiness extends LuBusiness {
27 27
             self::notFound("Effect does not exist");
28 28
         }
29 29
 
30
+        ImagesBusiness::prepareImage($data->getImage());
31
+
30 32
         /**
31 33
          * @var $filter AbstractFilter
32 34
          */

+ 8
- 2
app/Http/Business/ImagesBusiness.php View File

@@ -42,6 +42,12 @@ class ImagesBusiness extends LuBusiness {
42 42
         echo file_get_contents($dbo->getPath());
43 43
         exit;
44 44
     }
45
+    
46
+    public static function prepareImage(\Imagick $image)
47
+    {
48
+        $image->scaleImage(420, 420, true);
49
+        $image->setImageFormat(self::IMAGES_FORMAT);
50
+    }
45 51
 
46 52
     public static function upload(ImageUploadDbo $image, LuticateUsersDbo $_user)
47 53
     {
@@ -55,9 +61,9 @@ class ImagesBusiness extends LuBusiness {
55 61
         if (is_null($dbo->getName()) || $dbo->getName() === "") {
56 62
             $dbo->setName(Carbon::now()->toW3cString());
57 63
         }
64
+        
65
+        self::prepareImage($image->getImage());
58 66
 
59
-        $image->getImage()->scaleImage(420, 420, true);
60
-        $image->getImage()->setImageFormat(self::IMAGES_FORMAT);
61 67
         try
62 68
         {
63 69
             $image->getImage()->writeImage($path);

+ 11
- 0
public/app/controllers/upload.controller.js View File

@@ -3,6 +3,17 @@ angular.module('app')
3 3
         function($scope, $state, $mdDialog, EffectsBusiness, ImagesBusiness, luticateAuthCache, errorDialogMd) {
4 4
 
5 5
             $scope.image = null;
6
+
7
+            $scope.effects = [
8
+                {
9
+                    name: "Black and White",
10
+                    id: "BlackAndWhite"
11
+                },
12
+                {
13
+                    name: "GrayScale",
14
+                    id: "GrayScale"
15
+                }
16
+            ];
6 17
             
7 18
             var promiseImage = {
8 19
                 id: "promiseImage",

+ 5
- 0
public/app/views/upload.html View File

@@ -1,6 +1,11 @@
1 1
 <div layout="column" layout-fill layout-align="top center">
2 2
 
3 3
     <h1>Upload</h1>
4
+
5
+    <div class="col-xs12" ng-show="image != null">
6
+        <md-button ng-repeat="effect in effects" ng-click="applyEffect(effect.id, null)">{{effect.name}}</md-button>
7
+    </div>
8
+
4 9
     <div ng-show="isUploadVisible()" class="col-xs-6" lu-busy="imageView">
5 10
 
6 11
         <div class="center-block">

Loading…
Cancel
Save