예제 #1
0
 function TransformImage(&$imageString)
 {
     echo $this->imageFilter->ApplyFilter($imageString);
 }
예제 #2
0
 public function AfterSetAllDatasetValues()
 {
     $valueChanged = true;
     $postWrapper = ArrayWrapper::createPostWrapper();
     $filesWrapper = ArrayWrapper::createFilesWrapper();
     $value = $this->GetEditControl()->extractFilePathFromArray($postWrapper, $filesWrapper, $valueChanged);
     if ($valueChanged && $value === null) {
         $this->clearImageAndThumbnail();
         return;
     }
     $original_file_extension = $this->GetEditControl()->extractFileTypeFromArray($postWrapper, $filesWrapper);
     $original_file_name = $this->GetEditControl()->extractFileNameFromArray($postWrapper, $filesWrapper);
     $file_size = $this->GetEditControl()->extractFileSizeFromArray($postWrapper, $filesWrapper);
     $target = $this->GetNewFileName($original_file_name, $original_file_extension, $file_size);
     if ($valueChanged && isset($target) && !empty($target)) {
         FileUtils::MoveUploadedFile($value, $target, $this->replaceUploadedFileIfExist);
         if ($this->GetSetToNullFromPost()) {
             $this->clearImageAndThumbnail();
         } elseif ($this->GetSetToDefaultFromPost()) {
             $this->GetDataset()->SetFieldValueByName($this->GetFieldName(), null, true);
             if ($this->useThumbnailGeneration) {
                 $this->GetDataset()->SetFieldValueByName($this->fieldNameToSaveThumbnailPath, null);
             }
         } else {
             $this->GetDataset()->SetFieldValueByName($this->GetFieldName(), $target);
             if ($this->useThumbnailGeneration) {
                 $image = file_get_contents($target);
                 $thumbnailFileName = $this->GetThumbnailFileName($original_file_name, $original_file_extension, $file_size);
                 $this->thumbnailImageFilter->ApplyFilter($image, $thumbnailFileName);
                 $this->GetDataset()->SetFieldValueByName($this->fieldNameToSaveThumbnailPath, $thumbnailFileName);
             }
         }
     }
 }