@ 2014-01-22T02:16:43Z <?php
/**
CONFIG
*/
$pageConf['title'] = "";
$pageConf['desc'] = "";
$pageConf['keywords'] = "";
/**
PAGE SPECIFIC
*/
set_time_limit(600);
/* FUNCTIONS */
function getExtension($str) {
$i = strrpos($str,".");
if (!$i) { return ""; }
$l = strlen($str) - $i;
$ext = substr($str,$i+1,$l);
return $ext;
}
function imageThumbnail($inputFileName, $maxSize = 500)
{
$info = getimagesize($inputFileName);
$type = isset($info['type']) ? $info['type'] : $info[2];
// Check support of file type
if ( !(imagetypes() & $type) )
{
// Server does not support file type
return false;
}
$width = isset($info['width']) ? $info['width'] : $info[0];
$height = isset($info['height']) ? $info['height'] : $info[1];
// Calculate aspect ratio
$wRatio = $maxSize / $width;
$hRatio = $maxSize / $height;
// Using imagecreatefromstring will automatically detect the file type
$sourceImage = imagecreatefromstring(file_get_contents($inputFileName));
// Calculate a proportional width and height no larger than the max size.
if ( ($width <= $maxSize) && ($height <= $maxSize) )
{
// Input is smaller than thumbnail, do nothing
return $sourceImage;
}
elseif ( ($wRatio * $height) < $maxSize )
{
// Image is horizontal
$tHeight = ceil($wRatio * $height);
$tWidth = $maxSize;
}
else
{
// Image is vertical
$tWidth = ceil($hRatio * $width);
$tHeight = $maxSize;
}
$thumb = imagecreatetruecolor($tWidth, $tHeight);
if ( $sourceImage === false )
{
// Could not load image
return false;
}
// Copy resampled makes a smooth thumbnail
imagecopyresampled($thumb, $sourceImage, 0, 0, 0, 0, $tWidth, $tHeight, $width, $height);
imagedestroy($sourceImage);
return $thumb;
}
function imageToFile($im, $fileName, $quality = 80)
{
if ( !$im || file_exists($fileName) )
{
return false;
}
$ext = strtolower(substr($fileName, strrpos($fileName, '.')));
switch ( $ext )
{
case '.gif':
imagegif($im, $fileName);
break;
case '.jpg':
case '.jpeg':
imagejpeg($im, $fileName, $quality);
break;
case '.png':
imagepng($im, $fileName);
break;
default:
return false;
}
return true;
}
/* UPLOAD */
if(isset($_POST['Submit'])) {
$done = 0;
for ($i = 0; $i < count($_FILES['file']['name']); $i++) {
// stop if 10 files successfully done already
if ($done >= 10) {
echo 'Limit of 10 files at one time reached.';
break;
}
// read name of file submitted for uploading
$file = $_FILES['file']['name'][$i];
// check
if (!$image) {
continue;
}
// determine type of file
$extension = strtolower(getExtension(stripslashes($_FILES['file']['name'][$i])));
if (($extension == 'jpg') || ($extension == 'jpeg') || ($extension == 'bmp') || ($extension == 'png') || ($extension == 'gif')) {
// check filesize
if (filesize($_FILES['image']['tmp_name'][$i]) > 10240*1024)
{
$error = 1;
}
// check mimetype
$fileinfo = getimagesize($_FILES['image']['tmp_name'][$i]);
if ($fileinfo['mime'] != 'image/gif' && $fileinfo['mime'] != 'image/jpeg' && $fileinfo['mime'] != 'image/png' && $fileinfo['mime'] != 'image/pjpeg' && isset($fileinfo))
{
$error = 1;
}
// set file type
$fileType = 'image';
}
else if (($extension == 'mpg') || ($extension == 'mov') || ($extension == 'flv') || ($extension == 'mp4') || ($extension == 'wmv') || ($extension == 'webm') || ($extension == 'mkv') || ($extension == 'ogg')) {
// check filesize
if (filesize($_FILES['image']['tmp_name'][$i]) > 10240*1024)
{
$error = 1;
}
// check mimetype
$fileinfo = getimagesize($_FILES['image']['tmp_name'][$i]);
if ($fileinfo['mime'] != 'video/mpeg' && $fileinfo['mime'] != 'video/mp4' && $fileinfo['mime'] != 'video/ogg' && $fileinfo['mime'] != 'video/x-ms-wmv' && $fileinfo['mime'] != 'video/webm' && $fileinfo['mime'] != 'video/quicktime' && $fileinfo['mime'] != 'video/x-flv' && $fileinfo['mime'] != 'video/x-matroska' && isset($fileinfo))
{
$error = 1;
}
// set file type
$fileType = 'video';
}
else {
$error = 1;
}
// upload file to correct directory
if empty($error) {
$done++;
// set paths
// set folder path
$datepath = date('mY');
$file_path = $_SERVER['DOCUMENT_ROOT'] . '/files/' . $datepath . '/';
$file_thumb_path = $_SERVER['DOCUMENT_ROOT'] . '/files/thumbs/' . $datepath . '/';
// upload to permanent location
$file_id = randId(8,0,1);
copy($_FILES['image']['tmp_name'][$i], $file_path . $file_id . $extension);
// database
// $file_id becomes file identifier
// associate $file_id with user account
// store $filetype
// generate thumbnail
// image
if ($filetype == 'image') {
$thumbgen = imageThumbnail($file_path . $file_id . $extension, 150);
imagetofile($thumbgen, $file_thumb_path . $file_id . $extension);
imagedestroy($thumbgen);
}
// video
if ($filetype == 'video') {
// actual size thumbnail (i.e. 640x480)
//$file_thumb_path . $file_id . $extension
// small thumbnail (150)
//$file_thumb_path . $file_id . '-small' . $extension
// video strip
//$file_thumb_path . $file_id . '-strip' . $extension
}
}
}
} else { ?>
<form style="margin-left:auto;margin-right:auto;" method="post" enctype="multipart/form-data" action="">
<input type="hidden" name="MAX_FILE_SIZE" value="10485760">
<input type="hidden" name="_mode" value="normal">
<div id="upload_fields">
<input name="file[]" type="file" size="30" alt="file select" multiple>
<br><p class="index_intro" style="font-size:10.5px">If your browser only lets you select one file at a time please use the <a href="classic.php" rel="nofollow">classic uploader</a>.</p>
</div>
<div id="uploading" style="visibility:hidden;height:0px;"><img src="/_assets/images/upload_progress1.gif" alt="Uploading"></div>
<input name="Submit" type="submit" id="submit" value="." style="color:#c1c6e1" onclick="uploadprogress('uploading');">
</form>
<?php } ?>
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Version System time (s) User time (s) Memory (MiB) 5.4.24 0.009 0.035 12.44 5.4.23 0.004 0.041 12.43 5.4.22 0.009 0.043 12.43 5.4.21 0.007 0.044 12.43 5.4.20 0.007 0.046 12.43 5.4.19 0.007 0.046 12.43 5.4.18 0.009 0.050 12.42 5.4.17 0.011 0.042 12.43 5.4.16 0.007 0.045 12.43 5.4.15 0.007 0.049 12.42 5.4.14 0.006 0.045 12.12 5.4.13 0.005 0.045 12.10 5.4.12 0.008 0.045 12.06 5.4.11 0.007 0.048 12.06 5.4.10 0.006 0.045 12.05 5.4.9 0.012 0.047 12.05 5.4.8 0.008 0.045 12.06 5.4.7 0.007 0.042 12.05 5.4.6 0.007 0.042 12.05 5.4.5 0.010 0.042 12.05 5.4.4 0.006 0.043 12.04 5.4.3 0.005 0.044 12.04 5.4.2 0.009 0.042 12.03 5.4.1 0.008 0.042 12.03 5.4.0 0.007 0.042 11.53 5.3.28 0.008 0.045 12.71 5.3.27 0.005 0.050 12.73 5.3.26 0.009 0.047 12.73 5.3.25 0.010 0.046 12.73 5.3.24 0.007 0.047 12.73 5.3.23 0.007 0.049 12.72 5.3.22 0.008 0.049 12.69 5.3.21 0.007 0.045 12.69 5.3.20 0.007 0.042 12.69 5.3.19 0.005 0.039 12.69 5.3.18 0.003 0.041 12.68 5.3.17 0.007 0.037 12.68 5.3.16 0.002 0.041 12.68 5.3.15 0.007 0.038 12.68 5.3.14 0.006 0.042 12.67 5.3.13 0.009 0.043 12.67 5.3.12 0.005 0.046 12.67 5.3.11 0.008 0.042 12.67 5.3.10 0.005 0.040 12.15 5.3.9 0.006 0.038 12.13 5.3.8 0.009 0.041 12.12 5.3.7 0.007 0.043 12.12 5.3.6 0.011 0.038 12.10 5.3.5 0.011 0.038 12.05 5.3.4 0.007 0.043 12.05 5.3.3 0.007 0.041 12.01 5.3.2 0.008 0.040 11.79 5.3.1 0.010 0.039 11.75 5.3.0 0.010 0.039 11.74
preferences:dark mode live preview
140.69 ms | 1394 KiB | 7 Q