Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 6520 | Rev 6595 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 6520 Rev 6594
Línea 604... Línea 604...
604
                            }
604
                            }
605
                        }
605
                        }
Línea 606... Línea 606...
606
                        
606
                        
-
 
607
                        
-
 
608
                    }
-
 
609
                  
-
 
610
                        $fileBase64Content = $this->params()->fromPost('background');
-
 
611
                        $target_path = $this->config['leaderslinked.fullpath.microlearning_slide'] .  $slide->uuid;
-
 
612
                        if($slide->background) {
-
 
613
                            if(!image ::delete($target_path, $slide->background)) {
-
 
614
                                return new JsonModel([
-
 
615
                                    'success'   => false,
-
 
616
                                    'data'   =>  'ERROR_THERE_WAS_AN_ERROR'
-
 
617
                                ]);
-
 
618
                            }
-
 
619
                        }
-
 
620
 
-
 
621
                        try {
-
 
622
                        
-
 
623
                            $fileBase64Content = base64_decode($fileBase64Content);
-
 
624
                            $filename      = 'background-' .uniqid() . '.png';
-
 
625
                            $tmp_filename = 'data' . DIRECTORY_SEPARATOR . 'tmp';
-
 
626
                            if(!file_exists($target_path)) {
-
 
627
                                mkdir($target_path, 0755, true);
-
 
628
                            }
-
 
629
                            $tmp_filename = 'data' . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . $filename;
-
 
630
                                file_put_contents($tmp_filename, $fileBase64Content);
-
 
631
                            
-
 
632
                            list($target_width, $target_height) = explode('x', $this->config['leaderslinked.image_sizes.microlearning_image_size']);
-
 
633
    
-
 
634
                            $crop_to_dimensions = true;
-
 
635
                            if(Image::uploadImage($tmp_filename, $target_path, $filename, $target_width, $target_height, $crop_to_dimensions )) {
-
 
636
                                $slide->background = basename($filename);
-
 
637
                                $slideMapper->update($slide);
-
 
638
                            }
-
 
639
                        } catch(\Throwable $e) {
-
 
640
                            error_log($e->getTraceAsString());
Línea 607... Línea 641...
607
                        
641
                        }     
608
                    }
642
 
609
                    
643
                    
610
                    if(isset($files['background']) && empty($files['background']['error'])) {
644
                    /*if(isset($files['background']) && empty($files['background']['error'])) {
611
                        if($slide->background) {
645
                        if($slide->background) {
612
                            if(!image ::delete($target_path, $slide->background)) {
646
                            if(!image ::delete($target_path, $slide->background)) {
Línea 629... Línea 663...
629
                                $slideMapper->update($slide);
663
                                $slideMapper->update($slide);
630
                            }
664
                            }
631
                        } catch(\Throwable $e) {
665
                        } catch(\Throwable $e) {
632
                            error_log($e->getTraceAsString());
666
                            error_log($e->getTraceAsString());
633
                        }
667
                        }
634
                    }
668
                    }*/
Línea 635... Línea 669...
635
                    
669
                    
Línea 636... Línea 670...
636
                    $this->logger->info('Se agrego la diapositiva ' . $slide->name, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
670
                    $this->logger->info('Se agrego la diapositiva ' . $slide->name, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
637
                    
671
                    
Línea 1033... Línea 1067...
1033
                            }
1067
                            }
1034
                        }
1068
                        }
Línea 1035... Línea 1069...
1035
                        
1069
                        
-
 
1070
                      
Línea -... Línea 1071...
-
 
1071
                    }
1036
                      
1072
 
1037
                    }
1073
                    
1038
                    
1074
                    /*
1039
                    if(isset($files['background']) && empty($files['background']['error'])) {
1075
                    if(isset($files['background']) && empty($files['background']['error'])) {
1040
                        if($slide->background) {
1076
                        if($slide->background) {
Línea 1058... Línea 1094...
1058
                                $slideMapper->update($slide);
1094
                                $slideMapper->update($slide);
1059
                            }
1095
                            }
1060
                        } catch(\Throwable $e) {
1096
                        } catch(\Throwable $e) {
1061
                            error_log($e->getTraceAsString());
1097
                            error_log($e->getTraceAsString());
1062
                        }
1098
                        }
1063
                    }
1099
                    }*/
Línea 1064... Línea 1100...
1064
                    
1100
                    
Línea 1065... Línea 1101...
1065
                    $this->logger->info('Se edito la diapositiva ' . $slide->name, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
1101
                    $this->logger->info('Se edito la diapositiva ' . $slide->name, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
1066
                    
1102