Exemplo n.º 1
0
 case '0':
     // Attached file
     if ($mdsp['filename']) {
         // Check if this variation is instantly available
         $filecheck = $mediaObj->verifyMediaDPFileExists($itemValue['item_id']);
         // Returns array [stauts,path,filename]
     } elseif ($mdsp['external_link']) {
         $externalLink = 1;
         // External Link
         $filecheck['status'] = checkExternalFile($mdsp['external_link']) > 400 ? 0 : 1;
         $filecheck['path'] = $mdsp['external_link'];
     }
     break;
 case '1':
     // Create Automatically
     if (in_array($media['file_ext'], getCreatableFormats())) {
         // Check original format
         $dsp['auto_create'] = true;
     }
     // Check for original at either external link or local
     if ($media['external_link']) {
         $externalLink = 1;
         // External Link
         $filecheck['status'] = checkExternalFile($media['external_link']) > 400 ? 0 : 1;
         $filecheck['path'] = $media['external_link'];
     } else {
         $filecheck = $mediaObj->verifyMediaFileExists();
         // Returns array [stauts,path,filename]
     }
     break;
 case '2':
Exemplo n.º 2
0
             }
         } else {
             die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
         }
         @fclose($in);
         @fclose($out);
     } else {
         die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
     }
 }
 // Check if file has been uploaded
 if (!$chunks || $chunk == $chunks - 1) {
     // Strip the temp .part suffix off
     rename("{$filePath}.part", $filePath);
     $fileNameParts = explode(".", $fileName);
     $creatableFiletypes = getCreatableFormats();
     $iconImage = $targetDir . "icon_" . basefilename($fileName) . ".jpg";
     $thumbImage = $targetDir . "thumb_" . basefilename($fileName) . ".jpg";
     $sampleImage = $targetDir . "sample_" . basefilename($fileName) . ".jpg";
     $filenameExt = strtolower(array_pop($fileNameParts));
     # CALCULATE THE MEMORY NEEDED ONLY IF IT IS A CREATABLE FORMAT
     if (in_array(strtolower($filenameExt), $creatableFiletypes)) {
         # FIGURE MEMORY NEEDED
         $mem_needed = figure_memory_needed($targetDir . $fileName);
         if (ini_get("memory_limit")) {
             $memory_limit = ini_get("memory_limit");
         } else {
             $memory_limit = $config['DefaultMemory'];
         }
         # IF IMAGEMAGICK ALLOW TWEAKED MEMORY LIMIT
         if (class_exists('Imagick') and $config['settings']['imageproc'] == 2) {