Changeset 918 for pro-violet-viettel
- Timestamp:
- May 11, 2015 11:28:53 AM (10 years ago)
- Location:
- pro-violet-viettel/www/deploy/api/platform
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pro-violet-viettel/www/deploy/api/platform/lib/violetUtil.class.php
r916 r918 40 40 41 41 public function createThumb($pathToImage="") { 42 43 42 if (is_file($pathToImage)) { 44 43 $info = pathinfo($pathToImage); -
pro-violet-viettel/www/deploy/api/platform/modules/space/actions/actions.class.php
r916 r918 181 181 182 182 private function createPreview($fileurl, $userId, $fileid) { 183 $thumbnail=""; 183 184 $url = "https://docs.google.com/gview?url=" . urlencode($fileurl) . ""; 184 185 file_put_contents("1.html", $url); … … 215 216 } 216 217 file_put_contents("previews/" . $userId . "/" . $fileid . "/" . $i . ".png", $image); 218 if ($count==1) 219 { 220 $file_path= str_replace("http://" . $_SERVER['SERVER_NAME'], $_SERVER['DOCUMENT_ROOT'], $fileurl); 221 $file_path= str_replace(pathinfo($file_path, PATHINFO_EXTENSION), "png", $file_path); 222 file_put_contents($file_path, $image); 223 $thumbnail=violetUtil::createThumb($file_path); 224 } 217 225 } else { 218 226 break; … … 220 228 } 221 229 } 222 return $ count;230 return $thumbnail; 223 231 } 224 232 … … 464 472 $ext = pathinfo($fileUrl, PATHINFO_EXTENSION); 465 473 $ext = strtolower($ext); 466 474 $thumbnail=""; 467 475 if (in_array($ext, array("ppt", "xls", "doc", "pdf", "docx", "pptx", "xlsx"))) { 468 $th is->createPreview($fileUrl, $userId, $tblfile->getFileId());476 $thumbnail=$this->createPreview($fileUrl, $userId, $tblfile->getFileId()); 469 477 } 470 478 … … 472 480 $aryError = array('err' => "", 'errCode' => 0); 473 481 $ext = pathinfo($fileUrl, PATHINFO_EXTENSION); 474 $thumbnail = ""; 482 if ($thumbnail=="") 483 { 475 484 if (in_array(strtolower($ext), array("jpg", "jpeg", "png", "gif"/* , "tiff", "dvg", "bmp" */))) { 476 485 $thumbnail=violetUtil::createThumb($filePath); 477 486 } 478 if (file_exists("previews/$userId/" . $tblfile->getFileId() . "/0.png")) { 479 $thumbnail = "previews/$userId/" . $tblfile->getFileId() . "/0.png"; 480 } 487 } 488 481 489 $aryFiles = array( 482 490 0 => array('id' => $tblfile->getFileId(), 'thumbnail' => $thumbnail, 'fileurl' => $fileUrl, 'name' => $fileName, 'minetype' => $ext, 'size' => $fileSize, 'parentID' => $catId), -
pro-violet-viettel/www/deploy/api/platform/modules/space/templates/dirSuccess.php
r916 r918 32 32 $filePath=""; 33 33 $thumbnail=""; 34 if (in_array($ext, array("jpg","png","jpeg","gif" )))34 if (in_array($ext, array("jpg","png","jpeg","gif",""))) 35 35 { 36 36 $names = explode(".", $name); … … 38 38 $filePath = str_replace($_SERVER['DOCUMENT_ROOT'], '', $filePath); 39 39 $thumbnail = str_replace($name, "", $fileName). $names[0].'_thumb.'.$ext; 40 $thumbnail= ltrim ($thumbnail, '/'); 40 41 } 41 42 else 42 43 { 43 if (file_exists("previews/$userId/".$tblfile->getFileId()."/0.png")) 44 { 45 $thumbnail="previews/$userId/".$tblfile->getFileId()."/0.png"; 46 } 44 $names = explode(".", $name); 45 $filePath = $tblres->getFullFilename(); 46 $filePath = str_replace($_SERVER['DOCUMENT_ROOT'], '', $filePath); 47 $thumbnail = str_replace($name, "", $fileName). $names[0].'_thumb.png'; 48 $thumbnail= ltrim ($thumbnail, '/'); 49 if (!file_exists($thumbnail)) 50 { 51 $thumbnail=""; 52 } 53 47 54 } 48 55
Note: See TracChangeset
for help on using the changeset viewer.