Browse Source

added name in upload

develop
Robin Thoni 8 years ago
parent
commit
4db47c5fb0

+ 4
- 0
app/Http/Business/ImagesBusiness.php View File

51
         $dbo->setUserId($_user->getId());
51
         $dbo->setUserId($_user->getId());
52
         $dbo->setPath($path);
52
         $dbo->setPath($path);
53
         $dbo->setDate(Carbon::now());
53
         $dbo->setDate(Carbon::now());
54
+        $dbo->setName($image->getName());
55
+        if (is_null($dbo->getName()) || $dbo->getName() === "") {
56
+            $dbo->setName(Carbon::now()->toW3cString());
57
+        }
54
 
58
 
55
         $image->getImage()->scaleImage(420, 420, true);
59
         $image->getImage()->scaleImage(420, 420, true);
56
         $image->getImage()->setImageFormat(self::IMAGES_FORMAT);
60
         $image->getImage()->setImageFormat(self::IMAGES_FORMAT);

+ 0
- 2
app/Http/routes.php View File

21
 $route->get("/api/images/$image_id", "Images", "getRawById");
21
 $route->get("/api/images/$image_id", "Images", "getRawById");
22
 $route->post("/api/images/upload", "Images", "upload", Permissions::UPLOAD);
22
 $route->post("/api/images/upload", "Images", "upload", Permissions::UPLOAD);
23
 $route->post("/api/images/$image_id/del", "Images", "del", Permissions::UPLOAD);
23
 $route->post("/api/images/$image_id/del", "Images", "del", Permissions::UPLOAD);
24
-
25
-sleep(2);

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

63
                     name: $scope.image.name
63
                     name: $scope.image.name
64
                 }, promiseImage).then(function(data)
64
                 }, promiseImage).then(function(data)
65
                 {
65
                 {
66
-                    console.log(data);
66
+                    $state.go("images");
67
                 }, errorDialogMd.errorDialog);
67
                 }, errorDialogMd.errorDialog);
68
             };
68
             };
69
 
69
 

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

12
                 </p>
12
                 </p>
13
             </div>
13
             </div>
14
 
14
 
15
+            <md-input-container class="col-xs-12">
16
+                <label for="name">Name</label>
17
+                <input name="name" id="name" type="text" ng-model="image.name" required>
18
+            </md-input-container>
19
+
15
             <md-button ng-show="canUpload()" ng-click="upload()" >Upload</md-button>
20
             <md-button ng-show="canUpload()" ng-click="upload()" >Upload</md-button>
16
             <input type="file" class="hidden-input" id="filePicker">
21
             <input type="file" class="hidden-input" id="filePicker">
17
         </div>
22
         </div>

Loading…
Cancel
Save