Parcourir la source

added name in upload

develop
Robin Thoni il y a 8 ans
Parent
révision
4db47c5fb0

+ 4
- 0
app/Http/Business/ImagesBusiness.php Voir le fichier

@@ -51,6 +51,10 @@ class ImagesBusiness extends LuBusiness {
51 51
         $dbo->setUserId($_user->getId());
52 52
         $dbo->setPath($path);
53 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 59
         $image->getImage()->scaleImage(420, 420, true);
56 60
         $image->getImage()->setImageFormat(self::IMAGES_FORMAT);

+ 0
- 2
app/Http/routes.php Voir le fichier

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

+ 1
- 1
public/app/controllers/upload.controller.js Voir le fichier

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

+ 5
- 0
public/app/views/upload.html Voir le fichier

@@ -12,6 +12,11 @@
12 12
                 </p>
13 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 20
             <md-button ng-show="canUpload()" ng-click="upload()" >Upload</md-button>
16 21
             <input type="file" class="hidden-input" id="filePicker">
17 22
         </div>

Chargement…
Annuler
Enregistrer