Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 17013 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 17013 Rev 17018
Línea 119... Línea 119...
119
                }
119
                }
Línea 120... Línea 120...
120
                
120
                
121
                $habitEmojiMapper = HabitEmojiMapper::getInstance($this->adapter);
121
                $habitEmojiMapper = HabitEmojiMapper::getInstance($this->adapter);
Línea 122... Línea 122...
122
                $paginator = $habitEmojiMapper->fetchAllDataTableByCompanyId($currentCompany->id, $search,  $page, $records_x_page, $order_field, $order_direction);
122
                $paginator = $habitEmojiMapper->fetchAllDataTableByCompanyId($currentCompany->id, $search,  $page, $records_x_page, $order_field, $order_direction);
123
 
123
 
Línea 124... Línea 124...
124
                $storage = Storage::getInstance($this->config);
124
                $storage = Storage::getInstance($this->config, $this->adapter);
125
                $path = $storage->getPathHabitEmoji();
125
                $path = $storage->getPathHabitEmoji();
126
                
126
                
Línea 233... Línea 233...
233
                    
233
                    
234
                    $target_size = $this->config['leaderslinked.image_sizes.emoji'];
234
                    $target_size = $this->config['leaderslinked.image_sizes.emoji'];
Línea 235... Línea 235...
235
                    list($target_width, $target_height) = explode('x', $target_size);
235
                    list($target_width, $target_height) = explode('x', $target_size);
-
 
236
                    
236
                    
237
                    
Línea 237... Línea 238...
237
                    
238
                    $image = \LeadersLinked\Library\Image::getInstance($this->config);
Línea 238... Línea 239...
238
                    $image = Image::getInstance($this->config);
239
                    $storage = \LeadersLinked\Library\Storage::getInstance($this->config, $this->adapter);
239
                    $target_path = $image->getStorage()->getPathHabitEmoji();
240
                    $target_path = $storage->getPathHabitEmoji();
240
                    
241
                    
241
                    $files = $this->getRequest()->getFiles()->toArray();
242
                    $files = $this->getRequest()->getFiles()->toArray();
Línea 242... Línea 243...
242
 
243
 
243
                    
244
                    
Línea -... Línea 245...
-
 
245
                    if(isset($files['image']) && empty($files['image']['error'])) {
244
                    if(isset($files['image']) && empty($files['image']['error'])) {
246
                        $tmp_filename  = $files['image']['tmp_name'];
245
                        $tmp_filename  = $files['image']['tmp_name'];
247
                        $filename      = explode('.',  $files['image']['name']); 
246
                        $filename      = explode('.',  $files['image']['name']); 
248
                        $filename       = Functions::normalizeStringFilename(uniqid() . '-' . $filename[0].'.png');
-
 
249
                     
247
                        $filename       = Functions::normalizeStringFilename(uniqid() . '-' . $filename[0].'.png');
250
                        $crop_to_dimensions = true;
-
 
251
                        $full_tmp_filename = $image->uploadProcessChangeSize($tmp_filename, $filename, $target_width, $target_height, $crop_to_dimensions);
248
                     
252
                        
Línea 249... Línea 253...
249
                        $crop_to_dimensions = true;
253
                        if($full_tmp_filename) {
Línea 337... Línea 341...
337
            if($result) {
341
            if($result) {
338
                $this->logger->info('Se borro el emoji : ' .  $habitEmoji->name, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
342
                $this->logger->info('Se borro el emoji : ' .  $habitEmoji->name, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
Línea 339... Línea 343...
339
               
343
               
Línea -... Línea 344...
-
 
344
                if($habitEmoji->image) {
340
                if($habitEmoji->image) {
345
                    
-
 
346
           
341
                    
347
                    $storage = \LeadersLinked\Library\Storage::getInstance($this->config, $this->adapter);
342
                    $image = Image::getInstance($this->config);
348
                    
343
                    $target_path = $image->getStorage()->getPathHabitEmoji();
349
                    $target_path = $storage->getPathHabitEmoji();
Línea 344... Línea 350...
344
                    $image->getStorage()->deleteFile($target_path, $habitEmoji->uuid, $habitEmoji->image);
350
                    $storage->delete($target_path, $habitEmoji->uuid, $habitEmoji->image);
345
                }
351
                }
346
                
352
                
Línea 397... Línea 403...
397
                'data'   => 'ERROR_UNAUTHORIZED'
403
                'data'   => 'ERROR_UNAUTHORIZED'
398
            ]);
404
            ]);
399
        }
405
        }
Línea 400... Línea 406...
400
        
406
        
401
        if($request->isGet()) {
407
        if($request->isGet()) {
402
            $storage = Storage::getInstance($this->config);
408
            $storage = Storage::getInstance($this->config, $this->adapter);
Línea 403... Línea 409...
403
            $path = $storage->getPathHabitEmoji();
409
            $path = $storage->getPathHabitEmoji();
404
            
410
            
Línea 443... Línea 449...
443
                    
449
                    
444
                    
450
                    
Línea 445... Línea 451...
445
                    $files = $this->getRequest()->getFiles()->toArray();
451
                    $files = $this->getRequest()->getFiles()->toArray();
-
 
452
                    if(isset($files['image']) && empty($files['image']['error'])) {
-
 
453
                        
446
                    if(isset($files['image']) && empty($files['image']['error'])) {
454
                        $image      = \LeadersLinked\Library\Image::getInstance($this->config);
Línea 447... Línea 455...
447
                        
455
                        $storage    = \LeadersLinked\Library\Storage::getInstance($this->config, $this->adapter);
448
                        $image = Image::getInstance($this->config);
456
                        
449
                        $target_path = $image->getStorage()->getPathHabitEmoji();
457
                        $target_path =  $storage->getPathHabitEmoji();
Línea 450... Línea 458...
450
                        
458
                        
451
                        $tmp_filename  = $files['image']['tmp_name'];
459
                        $tmp_filename  = $files['image']['tmp_name'];
452
                        $filename      = explode('.',  $files['image']['name']);
460
                        $filename      = explode('.',  $files['image']['name']);
453
                        $filename       = Functions::normalizeStringFilename(uniqid() . '-' . $filename[0].'.png');
461
                        $filename       = Functions::normalizeStringFilename(uniqid() . '-' . $filename[0].'.png');
454
                        
462
                        
455
                        $crop_to_dimensions = true;
463
                        $crop_to_dimensions = true;
456
                        $unlink_source = true;
464
                        $full_tmp_filename = $image->uploadProcessChangeSize($tmp_filename, $filename, $target_width, $target_height,  $crop_to_dimensions);
457
 
465
                        
Línea -... Línea 466...
-
 
466
                        if($full_tmp_filename) {
-
 
467
                            
458
                        if($image->uploadImageChangeSize($tmp_filename, $target_path, $habitEmoji->uuid, $filename, $target_width, $target_height, $crop_to_dimensions, $unlink_source)) {
468
                            if($habitEmoji->image) {
459
                           
469
                                $image->getStorage()->deleteFile($target_path, $habitEmoji->uuid, $habitEmoji->image);
-
 
470
                            }
460
                            if($habitEmoji->image) {
471
                            
-
 
472
                            
-
 
473
                            if($storage->putFile($target_path, $habitEmoji->uuid,  $full_tmp_filename)) {
461
                                $image->getStorage()->deleteFile($target_path, $habitEmoji->uuid, $habitEmoji->image);
474
                                $habitEmoji->image = $filename;
Línea 462... Línea 475...
462
                            }
475
                                $habitEmojiMapper->update($habitEmoji);