Changeset 936 for pro-violet-viettel


Ignore:
Timestamp:
Jul 8, 2015 5:22:21 PM (10 years ago)
Author:
dungnv
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pro-violet-viettel/www/deploy/api/platform/modules/space/actions/actions.class.php

    r934 r936  
    151151        $res = TblspaceresourcePeer::doSelectOne($c);
    152152
    153         $thumbnailUrl = file_exists("previews/$userId/" . $tblfile->getFileId() . "/0.png") ? "http://".$_SERVER['HTTP_HOST']."/previews/$userId/" . $tblfile->getFileId() . "/0.png" : '';
     153        $thumbnail = file_exists("previews/$userId/" . $tblfile->getFileId() . "/0.png") ? "http://".$_SERVER['HTTP_HOST']."/previews/$userId/" . $tblfile->getFileId() . "/0.png" : '';
     154
     155        $ext = strtolower($tblfile->getFileType());
     156        $filePath="";
     157        $thumbnail="";
     158        if (in_array($ext, array("jpg","png","jpeg","gif","")))
     159        {
     160                $names = explode(".", $name);
     161                $filePath = $tblres->getFullFilename();
     162                $filePath = str_replace($_SERVER['DOCUMENT_ROOT'], '', $filePath);
     163                $thumbnail = str_replace($name, "", $fileName). $names[0].'_thumb.'.$ext;
     164                $thumbnail=   ltrim ($thumbnail, '/');
     165        }
    154166
    155167        $newFile = new stdClass();
     
    159171        $newFile->minetype = $currentFile->getFileType();
    160172        $newFile->fileurl = str_replace($_SERVER['DOCUMENT_ROOT'], "http://".$_SERVER['HTTP_HOST'], $res->getFullFilename());
    161         $newFile->thumbnail = $thumbnailUrl;
     173        $newFile->thumbnail = $thumbnail;
    162174        $newFile->size = $res->getResFilesize();
    163175
     
    455467        $fileErrorNum = $this->getRequest()->getFileError($file);
    456468        if ($fileErrorNum || $fileError)
    457             return false; 
     469            return false;
    458470
    459471        $tempFile = violetUtil::getTempPath() . $userId . '_' . $fileName;
     
    474486
    475487        $ext = pathinfo($fileUrl, PATHINFO_EXTENSION);
    476         $ext = strtolower($ext); 
     488        $ext = strtolower($ext);
    477489        $thumbnail="";
    478490        if (in_array($ext, array("ppt", "xls", "doc", "pdf", "docx", "pptx", "xlsx"))) {
Note: See TracChangeset for help on using the changeset viewer.