Commit 5615b79ffdb630853e5ef98861b8942eec8f7b6f
1 parent
c2336d81
Attempt to get path separators correct for windows in thumbnail plugin
Committed by: Paul Barrett Reviewed by: Prince Mbekwa
Showing
1 changed file
with
7 additions
and
7 deletions
plugins/thumbnails/thumbnails.php
| ... | ... | @@ -152,17 +152,17 @@ class thumbnailGenerator extends BaseProcessor |
| 152 | 152 | $pdfFile = $pdfDir . DIRECTORY_SEPARATOR . $this->document->getStoragePath(); |
| 153 | 153 | }else{ |
| 154 | 154 | $pdfDir = $default->pdfDirectory; |
| 155 | - $pdfFile = $pdfDir .'/'. $this->document->iId.'.pdf'; | |
| 155 | + $pdfFile = $pdfDir .DIRECTORY_SEPARATOR. $this->document->iId.'.pdf'; | |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - $thumbnaildir = $default->internalVarDirectory.'/thumbnails'; | |
| 159 | - $thumbnailfile = $thumbnaildir.'/'.$this->document->iId.'.jpg'; | |
| 158 | + $thumbnaildir = $default->internalVarDirectory.DIRECTORY_SEPARATOR.'thumbnails'; | |
| 159 | + $thumbnailfile = $thumbnaildir.DIRECTORY_SEPARATOR.$this->document->iId.'.jpg'; | |
| 160 | 160 | |
| 161 | 161 | //if thumbail dir does not exist, generate one and add an index file to block access |
| 162 | 162 | if (!file_exists($thumbnaildir)) { |
| 163 | 163 | mkdir($thumbnaildir, 0755); |
| 164 | - touch($thumbnaildir.'/index.html'); | |
| 165 | - file_put_contents($thumbnaildir.'/index.html', 'You do not have permission to access this directory.'); | |
| 164 | + touch($thumbnaildir.DIRECTORY_SEPARATOR.'index.html'); | |
| 165 | + file_put_contents($thumbnaildir.DIRECTORY_SEPARATOR.'index.html', 'You do not have permission to access this directory.'); | |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | // if there is no pdf that exists - hop out |
| ... | ... | @@ -216,7 +216,7 @@ class ThumbnailViewlet extends KTDocumentViewlet { |
| 216 | 216 | // Check for the thumbnail |
| 217 | 217 | global $default; |
| 218 | 218 | $varDir = $default->internalVarDirectory; |
| 219 | - $thumbnailfile = $varDir . '/thumbnails/'.$documentId.'.jpg'; | |
| 219 | + $thumbnailfile = $varDir . DIRECTORY_SEPARATOR . 'thumbnails'. DIRECTORY_SEPARATOR .$documentId.'.jpg'; | |
| 220 | 220 | |
| 221 | 221 | // if the thumbnail doesn't exist try to create it |
| 222 | 222 | if (!file_exists($thumbnailfile)){ |
| ... | ... | @@ -251,7 +251,7 @@ class ThumbnailViewlet extends KTDocumentViewlet { |
| 251 | 251 | public function get_width($documentId){ |
| 252 | 252 | global $default; |
| 253 | 253 | $varDir = $default->internalVarDirectory; |
| 254 | - $thumbnailfile = $varDir . '/thumbnails/'.$documentId.'.jpg'; | |
| 254 | + $thumbnailfile = $varDir . DIRECTORY_SEPARATOR.'thumbnails'.DIRECTORY_SEPARATOR.$documentId.'.jpg'; | |
| 255 | 255 | $size = getimagesize($thumbnailfile); |
| 256 | 256 | return $size[0]; |
| 257 | 257 | } | ... | ... |