Changeset 16005
- Timestamp:
- 03/04/09 22:55:20 (4 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/pkPersistentFileUploadPlugin/trunk/lib/widget/pkWidgetFormInputFilePersistent.class.php
r15978 r16005 70 70 { 71 71 // While we're here age off stale previews 72 $dir = sfConfig::get('sf_web_dir') . "/uploaded-image-preview"; 72 $subdir = sfConfig::get('sf_persistent_upload_preview_dir', "/uploaded-image-preview"); 73 $parentdir = sfConfig::get('sf_web_dir'); 74 $dir = "$parentdir$subdir"; 73 75 pkValidatorFilePersistent::removeOldFiles($dir); 74 $output = "$dir/$persistid.jpg"; 76 $imagePreview = $this->getOption('image-preview'); 77 $width = $imagePreview['width'] + 0; 78 $height = $imagePreview['height'] + 0; 79 $resizeType = $imagePreview['resizeType']; 80 if (!in_array($resizeType, array('c', 's'))) 81 { 82 $resizeType = 'c'; 83 } 84 $imagename = "$persistid.$width.$height.$resizeType.jpg"; 85 $url = "$subdir/$imagename"; 86 $output = "$dir/$imagename"; 75 87 if (!file_exists($output)) 76 88 { 77 $imagePreview = $this->getOption('image-preview');78 89 if ($imagePreview['resizeType'] === 'c') 79 90 { … … 90 101 mkdir($dir); 91 102 } 92 $path = "$dir/$persistid.jpg";93 103 pkImageConverter::$method( 94 104 $info['tmp_name'], 95 $ path,105 $output, 96 106 $imagePreview['width'], 97 107 $imagePreview['height']); 98 108 } 99 $result .= "<img src=' /uploaded-image-preview/$persistid.jpg' />";109 $result .= "<img src='$url' />"; 100 110 } 101 111 $result .= $this->getOption('existing-html');