• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP filesize_unlimited函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中filesize_unlimited函数的典型用法代码示例。如果您正苦于以下问题:PHP filesize_unlimited函数的具体用法?PHP filesize_unlimited怎么用?PHP filesize_unlimited使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了filesize_unlimited函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: get_original_imagesize

function get_original_imagesize($ref = "", $path = "", $extension = "jpg")
{
    $fileinfo = array();
    if ($ref == "" || $path == "") {
        return false;
    }
    global $imagemagick_path, $imagemagick_calculate_sizes;
    $file = $path;
    $filesize = filesize_unlimited($file);
    # imagemagick_calculate_sizes is normally turned off
    if (isset($imagemagick_path) && $imagemagick_calculate_sizes) {
        # Use ImageMagick to calculate the size
        $prefix = '';
        # Camera RAW images need prefix
        if (preg_match('/^(dng|nef|x3f|cr2|crw|mrw|orf|raf|dcr)$/i', $extension, $rawext)) {
            $prefix = $rawext[0] . ':';
        }
        # Locate imagemagick.
        $identify_fullpath = get_utility_path("im-identify");
        if ($identify_fullpath == false) {
            exit("Could not find ImageMagick 'identify' utility at location '{$imagemagick_path}'.");
        }
        # Get image's dimensions.
        $identcommand = $identify_fullpath . ' -format %wx%h ' . escapeshellarg($prefix . $file) . '[0]';
        $identoutput = run_command($identcommand);
        preg_match('/^([0-9]+)x([0-9]+)$/ims', $identoutput, $smatches);
        @(list(, $sw, $sh) = $smatches);
        if ($sw != '' && $sh != '') {
            sql_query("insert into resource_dimensions (resource, width, height, file_size) values('" . $ref . "', '" . $sw . "', '" . $sh . "', '" . $filesize . "')");
        }
    } else {
        # check if this is a raw file.
        $rawfile = false;
        if (preg_match('/^(dng|nef|x3f|cr2|crw|mrw|orf|raf|dcr)$/i', $extension, $rawext)) {
            $rawfile = true;
        }
        # Use GD to calculate the size
        if (!(@(list($sw, $sh) = @getimagesize($file)) === false) && !$rawfile) {
            sql_query("insert into resource_dimensions (resource, width, height, file_size) values('" . $ref . "', '" . $sw . "', '" . $sh . "', '" . $filesize . "')");
        } else {
            # Assume size cannot be calculated.
            $sw = "?";
            $sh = "?";
            global $ffmpeg_supported_extensions;
            if (in_array(strtolower($extension), $ffmpeg_supported_extensions) && function_exists('json_decode')) {
                $ffprobe_fullpath = get_utility_path("ffprobe");
                $file = get_resource_path($ref, true, "", false, $extension);
                $ffprobe_output = run_command($ffprobe_fullpath . " -v 0 " . escapeshellarg($file) . " -show_streams -of json");
                $ffprobe_array = json_decode($ffprobe_output, true);
                # Different versions of ffprobe store the dimensions in different parts of the json output. Test both.
                if (!empty($ffprobe_array['width'])) {
                    $sw = intval($ffprobe_array['width']);
                }
                if (!empty($ffprobe_array['height'])) {
                    $sh = intval($ffprobe_array['height']);
                }
                if (isset($ffprobe_array['streams']) && is_array($ffprobe_array['streams'])) {
                    foreach ($ffprobe_array['streams'] as $stream) {
                        if (!empty($stream['codec_type']) && $stream['codec_type'] === 'video') {
                            $sw = intval($stream['width']);
                            $sh = intval($stream['height']);
                            break;
                        }
                    }
                }
            }
            if ($sw !== '?' && $sh !== '?') {
                # Size could be calculated after all
                sql_query("insert into resource_dimensions (resource, width, height, file_size) values('" . $ref . "', '" . $sw . "', '" . $sh . "', '" . $filesize . "')");
            } else {
                # Size cannot be calculated.
                $sw = "?";
                $sh = "?";
                # Insert a dummy row to prevent recalculation on every view.
                sql_query("insert into resource_dimensions (resource, width, height, file_size) values('" . $ref . "','0', '0', '" . $filesize . "')");
            }
        }
    }
    $fileinfo[0] = $filesize;
    $fileinfo[1] = $sw;
    $fileinfo[2] = $sh;
    return $fileinfo;
}
开发者ID:perryrothjohnson,项目名称:resourcespace,代码行数:83,代码来源:resource_functions.php


示例2: alt_from_resource

function alt_from_resource($source,$target,$name='',$delete=false){
	// Copy a resource as an alt file of another resource
	// alt is the source resource, $ref is the target resource that will get the new alternate
	global $view_title_field;
	$srcdata=get_resource_data($source);
	$srcext = $srcdata['file_extension'];
	$srcpath = get_resource_path($source,true,"",false,$srcext);
	if ($name == ''){
		$name = sql_value("select value from resource_data where resource_type_field = '$view_title_field' and resource = '$source'",'Untitled');
	}

	$description = '';
	if (!file_exists($srcpath)){
		echo "ERROR: File not found.";
		return false;
	} else {

		$file_size = filesize_unlimited($srcpath);
		$altid = add_alternative_file($target,$name,$description="",$file_name="",$file_extension="",$file_size,$alt_type='');
		$newpath = get_resource_path($target,true,"",true,$srcext,-1,1,false,'',$altid);
		copy($srcpath,$newpath);
		# Preview creation for alternative files (enabled via config)
                global $alternative_file_previews;
                if ($alternative_file_previews){
			create_previews($target,false,$srcext,false,false,$altid);
               	}
		if ($delete){
			// we are supposed to delete the original resource when we're done
			# Not allowed to edit this resource? They shouldn't have been able to get here.
			if ((!get_edit_access($source,$srcdata["archive"]))||checkperm('D')) {
				exit ("Permission denied.");
			} else {
				delete_resource($source);
			}
		}
		return true;

	}
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:39,代码来源:resource_to_alt.php


示例3: get_nopreview_icon

            # Show the no-preview icon
            ?>
	<img src="<?php 
            echo $baseurl_short;
            ?>
gfx/<?php 
            echo get_nopreview_icon($resource["resource_type"], $resource["file_extension"], true);
            ?>
" />
	<br />
	<?php 
        }
        if ($resource["file_extension"] != "") {
            ?>
<strong><?php 
            echo str_replace_formatted_placeholder("%extension", $resource["file_extension"], $lang["cell-fileoftype"]) . " (" . formatfilesize(@filesize_unlimited(get_resource_path($ref, true, "", false, $resource["file_extension"]))) . ")";
            ?>
</strong><?php 
            if (checkperm("w") && $resource["has_image"] == 1 && file_exists($wmpath)) {
                ?>
 &nbsp;&nbsp;<a href="#" onclick="jQuery('#wmpreview').toggle();jQuery('#preview').toggle();if (jQuery(this).text()=='<?php 
                echo $lang['showwatermark'];
                ?>
'){jQuery(this).text('<?php 
                echo $lang['hidewatermark'];
                ?>
');} else {jQuery(this).text('<?php 
                echo $lang['showwatermark'];
                ?>
');}"><?php 
                echo $lang['showwatermark'];
开发者ID:claytondaley,项目名称:resourcespace,代码行数:31,代码来源:edit.php


示例4: get_original_imagesize

function get_original_imagesize($ref = "", $path = "", $extension = "jpg")
{
    $fileinfo = array();
    if ($ref == "" || $path == "") {
        return false;
    }
    global $imagemagick_path, $imagemagick_calculate_sizes;
    $file = $path;
    $filesize = filesize_unlimited($file);
    # imagemagick_calculate_sizes is normally turned off
    if (isset($imagemagick_path) && $imagemagick_calculate_sizes) {
        # Use ImageMagick to calculate the size
        $prefix = '';
        # Camera RAW images need prefix
        if (preg_match('/^(dng|nef|x3f|cr2|crw|mrw|orf|raf|dcr)$/i', $extension, $rawext)) {
            $prefix = $rawext[0] . ':';
        }
        # Locate imagemagick.
        $identify_fullpath = get_utility_path("im-identify");
        if ($identify_fullpath == false) {
            exit("Could not find ImageMagick 'identify' utility at location '{$imagemagick_path}'.");
        }
        # Get image's dimensions.
        $identcommand = $identify_fullpath . ' -format %wx%h ' . escapeshellarg($prefix . $file) . '[0]';
        $identoutput = run_command($identcommand);
        preg_match('/^([0-9]+)x([0-9]+)$/ims', $identoutput, $smatches);
        @(list(, $sw, $sh) = $smatches);
        if ($sw != '' && $sh != '') {
            sql_query("insert into resource_dimensions (resource, width, height, file_size) values('" . $ref . "', '" . $sw . "', '" . $sh . "', '" . $filesize . "')");
        }
    } else {
        # check if this is a raw file.
        $rawfile = false;
        if (preg_match('/^(dng|nef|x3f|cr2|crw|mrw|orf|raf|dcr)$/i', $extension, $rawext)) {
            $rawfile = true;
        }
        # Use GD to calculate the size
        if (!(@(list($sw, $sh) = @getimagesize($file)) === false) && !$rawfile) {
            sql_query("insert into resource_dimensions (resource, width, height, file_size) values('" . $ref . "', '" . $sw . "', '" . $sh . "', '" . $filesize . "')");
        } else {
            # Size cannot be calculated.
            $sw = "?";
            $sh = "?";
            # Insert a dummy row to prevent recalculation on every view.
            sql_query("insert into resource_dimensions (resource, width, height, file_size) values('" . $ref . "','0', '0', '" . $filesize . "')");
        }
    }
    $fileinfo[0] = $filesize;
    $fileinfo[1] = $sw;
    $fileinfo[2] = $sh;
    return $fileinfo;
}
开发者ID:chandradrupal,项目名称:resourcespace,代码行数:52,代码来源:resource_functions.php


示例5: ProcessFolder


//.........这里部分代码省略.........
                                $path_parts = explode("/", $shortpath);
                                if ($level < count($path_parts)) {
                                    # Save the value
                                    print_r($path_parts);
                                    $value = $path_parts[$level - 1];
                                    update_field($r, $field, $value);
                                    echo " - Extracted metadata from path: {$value}\n";
                                }
                            }
                        }
                    }
                    // add the timestamp from this run to the keywords field to help retrieve this batch later
                    $currentkeywords = sql_value("select value from resource_data where resource = '{$r}' and resource_type_field = '1'", "");
                    if (strlen($currentkeywords) > 0) {
                        $currentkeywords .= ',';
                    }
                    update_field($r, 1, $currentkeywords . $staticsync_run_timestamp);
                    if (function_exists('staticsync_local_functions')) {
                        // if local cleanup functions have been defined, run them
                        staticsync_local_functions($r);
                    }
                    # Add any alternative files
                    $altpath = $fullpath . $staticsync_alternatives_suffix;
                    if ($staticsync_ingest && file_exists($altpath)) {
                        $adh = opendir($altpath);
                        while (($altfile = readdir($adh)) !== false) {
                            $filetype = filetype($altpath . "/" . $altfile);
                            if ($filetype == "file" && substr($file, 0, 1) != "." && strtolower($file) != "thumbs.db") {
                                # Create alternative file
                                global $lang;
                                # Find extension
                                $ext = explode(".", $altfile);
                                $ext = $ext[count($ext) - 1];
                                $aref = add_alternative_file($r, $altfile, strtoupper($ext) . " " . $lang["file"], $altfile, $ext, filesize_unlimited($altpath . "/" . $altfile));
                                $path = get_resource_path($r, true, "", true, $ext, -1, 1, false, "", $aref);
                                rename($altpath . "/" . $altfile, $path);
                                # Move alternative file
                            }
                        }
                    }
                    # check for alt files that match suffix list
                    if ($staticsync_alt_suffixes) {
                        $ss_nametocheck = substr($file, 0, strlen($file) - strlen($extension) - 1);
                        //review all files still in directory and see if they are alt files matching this one
                        $althandle = opendir($folder);
                        while (($altcandidate = readdir($althandle)) !== false) {
                            if ($filetype == "file" && substr($file, 0, 1) != "." && strtolower($file) != "thumbs.db") {
                                # Find extension
                                $ext = explode(".", $altcandidate);
                                $ext = $ext[count($ext) - 1];
                                $altcandidate_name = substr($altcandidate, 0, strlen($altcandidate) - strlen($ext) - 1);
                                $altcandidate_validated = false;
                                foreach ($staticsync_alt_suffix_array as $sssuffix) {
                                    if ($altcandidate_name == $ss_nametocheck . $sssuffix) {
                                        $altcandidate_validated = true;
                                        $thisfilesuffix = $sssuffix;
                                        break;
                                    }
                                }
                                if ($altcandidate_validated) {
                                    echo date('Y-m-d H:i:s    ');
                                    echo "    Attaching {$altcandidate} as alternative.\n";
                                    $filetype = filetype($folder . "/" . $altcandidate);
                                    # Create alternative file
                                    global $lang;
                                    if (preg_match("/^_VERSO[0-9]*/i", $thisfilesuffix)) {
开发者ID:perryrothjohnson,项目名称:resourcespace,代码行数:67,代码来源:staticsync_alt.php


示例6: sendFile

function sendFile($filename)
{
    $suffix = pathinfo($filename, PATHINFO_EXTENSION);
    $size = filesize_unlimited($filename);
    header('Content-Transfer-Encoding: binary');
    header('Content-Disposition: attachment; filename="' . mb_basename($filename) . '"');
    header('Content-Type: ' . get_mime_type($filename, $suffix));
    header('Content-Length: ' . $size);
    header("Content-Type: application/octet-stream");
    ob_end_flush();
    readfile($filename);
}
开发者ID:claytondaley,项目名称:resourcespace,代码行数:12,代码来源:utility.php


示例7: elseif

                } elseif (preg_match("/^_ORIG[0-9]*/i", $thisfilesuffix)) {
                    $alt_title = "Original Scan";
                } elseif (preg_match("/^_TPV[0-9]*/i", $thisfilesuffix)) {
                    $alt_title = "Title Page Verso";
                } elseif (preg_match("/^_TP[0-9]*/i", $thisfilesuffix)) {
                    $alt_title = "Title Page";
                } elseif (preg_match("/^_COV[0-9]*/i", $thisfilesuffix)) {
                    $alt_title = "Cover";
                } elseif (preg_match("/^_SCR[0-9]*/i", $thisfilesuffix)) {
                    $alt_title = "Inscription";
                } elseif (preg_match("/^_EX[0-9]*/i", $thisfilesuffix)) {
                    $alt_title = "Enclosure";
                } else {
                    $alt_title = $filename;
                }
                $aref = add_alternative_file($resource, $alt_title, strtoupper($ext) . " " . $lang["file"], $thefile, $ext, filesize_unlimited($thefile));
                $path = get_resource_path($resource, true, "", true, $ext, -1, 1, false, "", $aref);
                rename($thefile, $path);
                # Move alternative file
                global $alternative_file_previews;
                if ($alternative_file_previews) {
                    create_previews($resource, false, $ext, false, false, $aref);
                }
            } else {
                echo date('Y-m-d H:i:s    ');
                echo "matching resource not found.\n";
            }
        }
    }
}
function dir_tree($dir)
开发者ID:perryrothjohnson,项目名称:resourcespace,代码行数:31,代码来源:ss_alt_makeup.php


示例8: hook

     $tmp = hook("ffmpegmodaltparams", "", array($shell_exec_cmd, $ffmpeg_fullpath, $file, $n, $aref));
     if ($tmp) {
         $shell_exec_cmd = $tmp;
     }
     $output = run_command($shell_exec_cmd);
     if (isset($qtfaststart_path)) {
         if ($qtfaststart_path && file_exists($qtfaststart_path . "/qt-faststart") && in_array($ffmpeg_alternatives[$n]["extension"], $qtfaststart_extensions)) {
             $apathtmp = $apath . ".tmp";
             rename($apath, $apathtmp);
             $output = run_command($qtfaststart_path . "/qt-faststart " . escapeshellarg($apathtmp) . " " . escapeshellarg($apath) . " 2>&1");
             unlink($apathtmp);
         }
     }
     if (file_exists($apath)) {
         # Update the database with the new file details.
         $file_size = filesize_unlimited($apath);
         # SQL Connection may have hit a timeout
         sql_connect();
         sql_query("update resource_alt_files set file_name='" . escape_check($ffmpeg_alternatives[$n]["filename"] . "." . $ffmpeg_alternatives[$n]["extension"]) . "',file_extension='" . escape_check($ffmpeg_alternatives[$n]["extension"]) . "',file_size='" . $file_size . "',creation_date=now() where ref='{$aref}'");
         // add this filename to be added to resource.ffmpeg_alt_previews
         if (isset($ffmpeg_alternatives[$n]['alt_preview']) && $ffmpeg_alternatives[$n]['alt_preview'] == true) {
             $ffmpeg_alt_previews[] = basename($apath);
         }
     }
 }
 /*// update the resource table with any ffmpeg_alt_previews	
 		if (count($ffmpeg_alt_previews)>0){
 			$ffmpeg_alternative_previews=implode(",",$ffmpeg_alt_previews);
 			sql_query("update resource set ffmpeg_alt_previews='".escape_check($ffmpeg_alternative_previews)."' where ref='$ref'");
 		}
 		*/
开发者ID:chandradrupal,项目名称:resourcespace,代码行数:31,代码来源:ffmpeg_processing.php


示例9: file

     # Upload an alternative file (JUpload only)
     # Add a new alternative file
     $aref = add_alternative_file($alternative, $plfilename);
     # Work out the extension
     $extension = explode(".", $plfilepath);
     $extension = trim(strtolower($extension[count($extension) - 1]));
     # Find the path for this resource.
     $path = get_resource_path($alternative, true, "", true, $extension, -1, 1, false, "", $aref);
     # Move the sent file to the alternative file location
     # PLUpload - file was sent chunked and reassembled - use the reassembled file location
     $result = rename($plfilepath, $path);
     if ($result === false) {
         exit("ERROR: File upload error. Please check the size of the file you are trying to upload.");
     }
     chmod($path, 0777);
     $file_size = @filesize_unlimited($path);
     # Save alternative file data.
     sql_query("update resource_alt_files set file_name='" . escape_check($plfilename) . "',file_extension='" . escape_check($extension) . "',file_size='" . $file_size . "',creation_date=now() where resource='{$alternative}' and ref='{$aref}'");
     if ($alternative_file_previews_batch) {
         create_previews($alternative, false, $extension, false, false, $aref);
     }
     echo "SUCCESS";
     exit;
 }
 if ($replace == "" && $replace_resource == "") {
     # Standard upload of a new resource
     $ref = copy_resource(0 - $userref);
     # Copy from user template
     # Add to collection?
     if ($collection_add != "") {
         add_resource_to_collection($ref, $collection_add);
开发者ID:vongalpha,项目名称:resourcespace,代码行数:31,代码来源:upload_plupload.php


示例10: ProcessFolder


//.........这里部分代码省略.........
													echo "Will set access level to " . $lang['access' . $n] . " ($n)\n";
												}
											}

										} else {
										# Save the value
										print_r($path_parts);
										$value=$path_parts[$level-1];
										update_field ($r,$field,$value);
										echo " - Extracted metadata from path: $value\n";
										}
									}
								}
							}
						}
					
					// update access level
					sql_query("update resource set access = '$accessval' where ref = '$r'");
					
					# Add any alternative files
					$altpath=$fullpath . $staticsync_alternatives_suffix;
					if ($staticsync_ingest && file_exists($altpath))
						{
						$adh=opendir($altpath);
						while (($altfile = readdir($adh)) !== false)
							{
							$filetype=filetype($altpath . "/" . $altfile);
							if (($filetype=="file") && (substr($file,0,1)!=".") && (strtolower($file)!="thumbs.db"))
								{
								# Create alternative file
								global $lang;
								
								# Find extension
								$ext=explode(".",$altfile);$ext=$ext[count($ext)-1];
								
								$aref = add_alternative_file($r, $altfile, str_replace("?",strtoupper($ext),$lang["originalfileoftype"]), $altfile, $ext, filesize_unlimited($altpath . "/" . $altfile));
								$path=get_resource_path($r, true, "", true, $ext, -1, 1, false, "", $aref);
								rename ($altpath . "/" . $altfile,$path); # Move alternative file
								}
							}	
						}
					
					# Add to collection
					if ($staticsync_autotheme)
						{
						$test="";	
						$test=sql_query("select * from collection_resource where collection='$collection' and resource='$r'");
						if (count($test)==0){
							sql_query("insert into collection_resource(collection,resource,date_added) values ('$collection','$r',now())");
							}
						}
					}
				else
					{
					# Import failed - file still being uploaded?
					echo " *** Skipping file - it was not possible to move the file (still being imported/uploaded?) \n";
					}
				}
			else
				{
				# check modified date and update previews if necessary
				$filemod=filemtime($fullpath);
				if (array_key_exists($shortpath,$modtimes) && ($filemod>strtotime($modtimes[$shortpath])))
					{
					# File has been modified since we last created previews. Create again.
					$rd=sql_query("select ref,has_image,file_modified,file_extension from resource where file_path='" . (escape_check($shortpath)) . "'");
					if (count($rd)>0)
						{
						$rd=$rd[0];
						$rref=$rd["ref"];
						
						echo "Resource $rref has changed, regenerating previews: $fullpath\n";
						extract_exif_comment($rref,$rd["file_extension"]);
						
						# extract text from documents (e.g. PDF, DOC).
						global $extracted_text_field;
						if (isset($extracted_text_field)) {
							if (isset($unoconv_path) && in_array($extension,$unoconv_extensions)){
								// omit, since the unoconv process will do it during preview creation below
								}
							else {
							extract_text($rref,$extension);
							}
						}

						# Store original filename in field, if set
						global $filename_field;
						if (isset($filename_field))
							{
							update_field($rref,$filename_field,$file);	
							}
						
						create_previews($rref,false,$rd["file_extension"]);
						sql_query("update resource set file_modified=now() where ref='$rref'");
						}
					}
				}
			}	
		}	
	}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:101,代码来源:staticsync.php


示例11: run_command

            # A JPEG was created. Set as the file to process.
            $newfile = $target;
        }
    }
}
/* ----------------------------------------
	Try MP3 preview extraction via exiftool
   ----------------------------------------
*/
if ($extension == "mp3" && !isset($newfile)) {
    if ($exiftool_fullpath != false) {
        run_command($exiftool_fullpath . ' -b -picture ' . escapeshellarg($file) . ' > ' . $target);
    }
    if (file_exists($target)) {
        #if the file contains an image, use it; if it's blank, it needs to be erased because it will cause an error in ffmpeg_processing.php
        if (filesize_unlimited($target) > 0) {
            $newfile = $target;
        } else {
            unlink($target);
        }
    }
}
/* ----------------------------------------
	Try text file to JPG conversion
   ----------------------------------------
*/
# Support text files simply by rendering them on a JPEG.
if ($extension == "txt" && !isset($newfile)) {
    $text = wordwrap(file_get_contents($file), 90);
    $width = 650;
    $height = 850;
开发者ID:vongalpha,项目名称:resourcespace,代码行数:31,代码来源:preview_preprocessing.php


示例12: HookImagestreamUpload_pluploadInitialuploadprocessing


//.........这里部分代码省略.........
                        }
                        if ($height % 2) {
                            $height++;
                        }
                    }
                    if ($imageindex == count($imagestream_filelist) - 1) {
                        $additionalfile = $filenumber + 1;
                        $additionalfile = sprintf("%03d", $additionalfile);
                        copy($imagestream_workingfiles . DIRECTORY_SEPARATOR . "imagestream" . $filenumber . ".jpg", $imagestream_workingfiles . DIRECTORY_SEPARATOR . "imagestream" . $additionalfile . ".jpg");
                        $deletion_array[] = $imagestream_workingfiles . DIRECTORY_SEPARATOR . "imagestream" . $additionalfile . ".jpg";
                    }
                    $filenumber++;
                }
                #end of loop for each uploadedfile
                $imageindex++;
            }
            #Add the resource and move this zip file, set extension
            # Add to collection?
            if ($collection_add != "") {
                add_resource_to_collection($ref, $collection_add);
            }
            # Log this
            daily_stat("Resource upload", $ref);
            resource_log($ref, "u", 0);
            #Change this!!!!!!!!!!!
            #$status=upload_file($ref,true,false,false));
            if (!$config_windows) {
                @chmod($imagestreamzippath, 0777);
            }
            # Store extension in the database and update file modified time.
            sql_query("update resource set file_extension='zip',preview_extension='zip',file_modified=now(), has_image=0 where ref='{$ref}'");
            #update_field($ref,$filename_field,$filename);
            update_disk_usage($ref);
            # create the mp4 version
            # Add a new alternative file
            $aref = add_alternative_file($ref, "MP4 version");
            $imagestreamqtfile = get_resource_path($ref, true, "", false, "mp4", -1, 1, false, "", $aref);
            $shell_exec_cmd = $ffmpeg_fullpath . " -loglevel panic -y -r " . $imagestream_transitiontime . " -i " . $imagestream_workingfiles . DIRECTORY_SEPARATOR . "imagestream%3d.jpg -r " . $imagestream_transitiontime . " -s {$width}x{$height} " . $imagestreamqtfile;
            echo "Running command: " . $shell_exec_cmd;
            if ($config_windows) {
                $shell_exec_cmd = $ffmpeg_fullpath . " -loglevel panic -y -r " . $imagestream_transitiontime . " -i " . $imagestream_workingfiles . DIRECTORY_SEPARATOR . "imagestream%%3d.jpg -r " . $imagestream_transitiontime . " -s {$width}x{$height} " . $imagestreamqtfile;
                file_put_contents(get_temp_dir() . DIRECTORY_SEPARATOR . "imagestreammp4" . $session_hash . ".bat", $shell_exec_cmd);
                $shell_exec_cmd = get_temp_dir() . DIRECTORY_SEPARATOR . "imagestreammp4" . $session_hash . ".bat";
                $deletion_array[] = $shell_exec_cmd;
            }
            run_command($shell_exec_cmd);
            debug("DEBUG created slideshow MP4 video");
            if (!$config_windows) {
                @chmod($imagestreamqtfile, 0777);
            }
            $file_size = @filesize_unlimited($imagestreamqtfile);
            # Save alternative file data.
            sql_query("update resource_alt_files set file_name='quicktime.mp4',file_extension='mp4',file_size='" . $file_size . "',creation_date=now() where resource='{$ref}' and ref='{$aref}'");
            #create the FLV preview as per normal video processing if possible?
            if ($height < $ffmpeg_preview_min_height) {
                $height = $ffmpeg_preview_min_height;
            }
            if ($width < $ffmpeg_preview_min_width) {
                $width = $ffmpeg_preview_min_width;
            }
            if ($height > $ffmpeg_preview_max_height) {
                $width = ceil($width * ($ffmpeg_preview_max_height / $height));
                $height = $ffmpeg_preview_max_height;
            }
            if ($width > $ffmpeg_preview_max_width) {
                $height = ceil($height * ($ffmpeg_preview_max_width / $width));
                $width = $ffmpeg_preview_max_width;
            }
            $flvzippreviewfile = get_resource_path($ref, true, "pre", false, $ffmpeg_preview_extension);
            $shell_exec_cmd = $ffmpeg_fullpath . " -loglevel panic -y -i " . $imagestreamqtfile . " {$ffmpeg_preview_options} -s {$width}x{$height} " . $flvzippreviewfile;
            debug("Running command: " . $shell_exec_cmd);
            if ($config_windows) {
                file_put_contents(get_temp_dir() . DIRECTORY_SEPARATOR . "imagestreamflv" . $session_hash . ".bat", $shell_exec_cmd);
                $shell_exec_cmd = get_temp_dir() . DIRECTORY_SEPARATOR . "imagestreamflv" . $session_hash . ".bat";
                $deletion_array[] = $shell_exec_cmd;
            }
            run_command($shell_exec_cmd);
            debug("DEBUG created slideshow FLV video");
            if (!$config_windows) {
                @chmod($flvzippreviewfile, 0777);
            }
            #Tidy up
            rcRmdir($imagestream_workingfiles);
            rcRmdir($targetDir);
            foreach ($deletion_array as $tmpfile) {
                debug("\r\nDEBUG: Deleting: " . $tmpfile);
                delete_exif_tmpfile($tmpfile);
            }
            echo "SUCCESS";
            #return true;
            exit;
        } else {
            echo "SUCCESS";
            exit;
        }
        return true;
    } else {
        return false;
    }
}
开发者ID:chandradrupal,项目名称:resourcespace,代码行数:101,代码来源:upload_plupload.php


示例13: extract_icc

function extract_icc($infile)
{
    global $config_windows;
    # Locate imagemagick, or fail this if it isn't installed
    $convert_fullpath = get_utility_path("im-convert");
    if ($convert_fullpath == false) {
        return false;
    }
    if ($config_windows) {
        $stderrclause = '';
    } else {
        $stderrclause = '2>&1';
    }
    //$outfile=get_resource_path($ref,true,"",false,$extension.".icc");
    //new, more flexible approach: we will just create a file for anything the caller hands to us.
    //this makes things work with alternatives, the deepzoom plugin, etc.
    $path_parts = pathinfo($infile);
    $outfile = $path_parts['dirname'] . '/' . $path_parts['filename'] . '.' . $path_parts['extension'] . '.icc';
    if (file_exists($outfile)) {
        // extracted profile already existed. We'll remove it and start over
        unlink($outfile);
    }
    $cmdout = run_command("{$convert_fullpath} {$infile}" . '[0]' . " {$outfile} {$stderrclause}");
    if (preg_match("/no color profile is available/", $cmdout) || !file_exists($outfile) || filesize_unlimited($outfile) == 0) {
        // the icc profile extraction failed. So delete file.
        if (file_exists($outfile)) {
            unlink($outfile);
        }
        return false;
    }
    if (file_exists($outfile)) {
        return true;
    } else {
        return false;
    }
}
开发者ID:perryrothjohnson,项目名称:resourcespace,代码行数:36,代码来源:image_processing.php


示例14: echo

		?>
		<td class="DownloadButton DownloadDisabled"><?php echo $lang["access1"]?></td>
		<?php
		}
	?>
	</tr>
	<?php
	}
	
if (isset($flv_download) && $flv_download)
	{
	# Allow the FLV preview to be downloaded. $flv_download is set when showing the FLV preview video above.
	?>
	<tr class="DownloadDBlend">
	<td class="DownloadFileName"><h2><?php echo (isset($ffmpeg_preview_download_name)) ? $ffmpeg_preview_download_name : str_replace_formatted_placeholder("%extension", $ffmpeg_preview_extension, $lang["cell-fileoftype"]); ?></h2></td>
	<td class="DownloadFileSize"><?php echo formatfilesize(filesize_unlimited($flvfile))?></td>
	<td class="DownloadButton">
	<?php if (!$direct_download || $save_as){?>
		<a href="<?php echo $baseurl_short?>pages/terms.php?ref=<?php echo urlencode($ref)?>&search=<?php echo $search ?>&k=<?php echo urlencode($k)?>&url=<?php echo urlencode("pages/download_progress.php?ref=" . $ref . "&ext=" . $ffmpeg_preview_extension . "&size=pre&k=" . $k . "&search=" . urlencode($search) . "&offset=" . $offset . "&archive=" . $archive . "&sort=".$sort."&order_by=" . urlencode($order_by))?>"  onClick="return CentralSpaceLoad(this,true);"><?php echo $lang["action-download"] ?></a>
	<?php } else { ?>
		<a href="#" onclick="directDownload('<?php echo $baseurl_short?>pages/download_progress.php?ref=<?php echo urlencode($ref)?>&ext=<?php echo $ffmpeg_preview_extension?>&size=pre&k=<?php echo urlencode($k)?>')"><?php echo $lang["action-download"]?></a>
	<?php } // end if direct_download ?></td>
	</tr>
	<?php
	}

hook("additionalresourcetools2");
	
# Alternative files listing
$alt_access=hook("altfilesaccess");
if ($access==0) $alt_access=true; # open access (not restricted)
开发者ID:artsmia,项目名称:mia_resourcespace,代码行数:31,代码来源:view.php


示例15: get_image_sizes

function get_image_sizes($ref,$internal=false,$extension="jpg",$onlyifexists=true)
	{
	# Returns a table of available image sizes for resource $ref. The standard image sizes are translated using $lang. Custom image sizes are i18n translated.
	# The original image file assumes the name of the 'nearest size (up)' in the table

	global $imagemagick_calculate_sizes;

	# Work out resource type
	$resource_type=sql_value("select resource_type value from resource where ref='$ref'","");

	# add the original image
	$return=array();
	$lastname=sql_value("select name value from preview_size where width=(select max(width) from preview_size)",""); # Start with the highest resolution.
	$lastpreview=0;$lastrestricted=0;
	$path2=get_resource_path($ref,true,'',false,$extension);

	if (file_exists($path2) && !checkperm("T" . $resource_type . "_"))
	{ 
		$returnline=array();
		$returnline["name"]=lang_or_i18n_get_translated($lastname, "imagesize-");
		$returnline["allow_preview"]=$lastpreview;
		$returnline["allow_restricted"]=$lastrestricted;
		$returnline["path"]=$path2;
		$returnline["id"]="";
		$dimensions = sql_query("select width,height,file_size,resolution,unit from resource_dimensions where resource=". $ref);
		
		if (count($dimensions))
			{
			$sw = $dimensions[0]['width']; if ($sw==0) {$sw="?";}
			$sh = $dimensions[0]['height']; if ($sh==0) {$sh="?";}
			$filesize=$dimensions[0]['file_size'];
			# resolution and unit are not necessarily available, set to empty string if so.
			$resolution = ($dimensions[0]['resolution'])?$dimensions[0]['resolution']:"";
			$unit = ($dimensions[0]['unit'])?$dimensions[0]['unit']:"";
			}
		else
			{
			global $imagemagick_path;
			$file=$path2;
			$filesize=filesize_unlimited($file);
			
			# imagemagick_calculate_sizes is normally turned off 
			if (isset($imagemagick_path) && $imagemagick_calculate_sizes)
				{
				# Use ImageMagick to calculate the size
				
				$prefix = '';
				# Camera RAW images need prefix
				if (preg_match('/^(dng|nef|x3f|cr2|crw|mrw|orf|raf|dcr)$/i', $extension, $rawext)) { $prefix = $rawext[0] .':'; }

				# Locate imagemagick.
                $identify_fullpath = get_utility_path("im-identify");
                if ($identify_fullpath==false) {exit("Could not find ImageMagick 'identify' utility at location '$imagemagick_path'.");}	
				# Get image's dimensions.
                $identcommand = $identify_fullpath . ' -format %wx%h '. escapeshellarg($prefix . $file) .'[0]';
				$identoutput=run_command($identcommand);
				preg_match('/^([0-9]+)x([0-9]+)$/ims',$identoutput,$smatches);
				@list(,$sw,$sh) = $smatches;
				if (($sw!='') && ($sh!=''))
				  {
					sql_query("insert into resource_dimensions (resource, width, height, file_size) values('". $ref ."', '". $sw ."', '". $sh ."', '" . $filesize . "')");
					}
				}	
			else 
				{
				# check if this is a raw file.	
				$rawfile = false;
				if (preg_match('/^(dng|nef|x3f|cr2|crw|mrw|orf|raf|dcr)$/i', $extension, $rawext)){$rawfile=true;}
					
				# Use GD to calculate the size
				if (!((@list($sw,$sh) = @getimagesize($file))===false)&& !$rawfile)
				 	{		
					sql_query("insert into resource_dimensions (resource, width, height, file_size) values('". $ref ."', '". $sw ."', '". $sh ."', '" . $filesize . "')");
					}
				else
					{
					# Size cannot be calculated.
					$sw="?";$sh="?";
					
					# Insert a dummy row to prevent recalculation on every view.
					sql_query("insert into resource_dimensions (resource, width, height, file_size) values('". $ref ."','0', '0', '" . $filesize . "')");
					}
				}
			}
		if (!is_numeric($filesize)) {$returnline["filesize"]="?";$returnline["filedown"]="?";}
		else {$returnline["filedown"]=ceil($filesize/50000) . " seconds @ broadband";$returnline["filesize"]=formatfilesize($filesize);}
		$returnline["width"]=$sw;			
		$returnline["height"]=$sh;
		$returnline["extension"]=$extension;
		(isset($resolution))?$returnline["resolution"]=$resolution:$returnline["resolution"]="";
		(isset($unit))?$returnline["unit"]=$unit:$returnline["unit"]="";
		$return[]=$returnline;
	}
	# loop through all image sizes
	$sizes=sql_query("select * from preview_size order by width desc");
	for ($n=0;$n<count($sizes);$n++)
		{
		$path=get_resource_path($ref,true,$sizes[$n]["id"],false,"jpg");

		$resource_type=sql_value("select resource_type value from resource where ref='$ref'","");
//.........这里部分代码省略.........
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:101,代码来源:general.php


示例16: echo

		?>
		<td class="DownloadButton DownloadDisabled"><?php echo $lang["access1"]?></td>
		<?php
		}
	?>
	</tr>
	<?php
	}
	
if (isset($flv_download) && $flv_download)
	{
	# Allow the FLV preview to be downloaded. $flv_download is set when showing the FLV preview video above.
	?>
	<tr class="DownloadDBlend">
	<td><h2><?php echo (isset($ffmpeg_preview_download_name)) ? $ffmpeg_preview_download_name : str_replace_formatted_placeholder("%extension", $ffmpeg_preview_extension, $lang["cell-fileoftype"]); ?></h2></td>
	<td><?php echo formatfilesize(filesize_unlimited($flvfile))?></td>
	<td class="DownloadButton">
	<?php if (!$direct_download || $save_as){?>
		<a href="<?php echo $baseurl_short?>pages/terms.php?ref=<?php echo urlencode($ref)?>&search=<?php echo $search ?>&k=<?php echo urlencode($k)?>&url=<?php echo urlencode("pages/download_progress.php?ref=" . $ref . "&ext=" . $ffmpeg_preview_extension . "&size=pre&k=" . $k . "&search=" . urlencode($search) . "&offset=" . $offset . "&archive=" . $archive . "&sort=".$sort."&order_by=" . urlencode($order_by))?>"  onClick="return CentralSpaceLoad(this,true);"><?php ech 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP filesystemToInternal函数代码示例发布时间:2022-05-15
下一篇:
PHP filesize_h函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap