Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 6829 Rev 6830
Línea 372... Línea 372...
372
 
372
 
373
                    $fileBase64Content = $this->params()->fromPost('file');
373
                    $fileBase64Content = $this->params()->fromPost('file');
Línea 374... Línea 374...
374
                    try {
374
                    try {
375
                        
375
                        
376
                        $fileBase64Content = base64_decode($fileBase64Content);
376
                        $fileBase64Content = base64_decode($fileBase64Content);
377
                        $target_path = $this->config['leaderslinked.fullpath.microlearning_topic'] . $topic->uuid;
377
                        $target_path = $this->config['leaderslinked.fullpath.microlearning_capsule'] . $capsule->uuid;
378
                        $topic_filename      = 'topic-' .uniqid() . '.png';
378
                        $capsule_filename      = 'capsule-' .uniqid() . '.png';
379
                        $topic_tmp_filename = 'data' . DIRECTORY_SEPARATOR . 'tmp';
379
                        $capsule_tmp_filename = 'data' . DIRECTORY_SEPARATOR . 'tmp';
380
                        if(!file_exists($topic_tmp_filename)) {
380
                        if(!file_exists($capsule_tmp_filename)) {
381
                            mkdir($topic_tmp_filename, 0755, true);
381
                            mkdir($capsule_tmp_filename, 0755, true);
382
                        }
382
                        }
Línea 383... Línea 383...
383
                        $topic_tmp_filename = 'data' . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . $topic_filename;
383
                        $capsule_tmp_filename = 'data' . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . $capsule_filename;
Línea 384... Línea 384...
384
                            file_put_contents($topic_tmp_filename, $fileBase64Content);
384
                            file_put_contents($capsule_tmp_filename, $fileBase64Content);
385
                        
385
                        
386
                        list($target_width, $target_height) = explode('x', $this->config['leaderslinked.image_sizes.microlearning_image_size']);
386
                        list($target_width, $target_height) = explode('x', $this->config['leaderslinked.image_sizes.microlearning_image_size']);
387
 
387
 
388
                        $crop_to_dimensions = false;
388
                        $crop_to_dimensions = false;
389
                        if(Image::uploadImage($topic_tmp_filename, $target_path, $topic_filename, $target_width, $target_height, $crop_to_dimensions )) {
389
                        if(Image::uploadImage($capsule_tmp_filename, $target_path, $capsule_filename, $target_width, $target_height, $crop_to_dimensions )) {
390
                            $topic->image = basename($topic_filename);
390
                            $capsule->image = basename($capsule_filename);
391
                            $topicMapper->update($topic);
391
                            $capsuleMapper->update($capsule);