Neviem z akého dôvodu, ale nefunguje mi upload súborov väčších ako 5MB pritom upload_file_size je 128MB, menšie súbory, ako 5MB mi uploadne v pohode, akonáhle je súbor väčší ako 5MB tak to nefunguje a nevypiše ani žiadnu chybu, tiež nechcem si robiť reklamu, ale môžte si to skúsiť na shotimg.net zip upload, neviem z akého dôvodu to nefunguje, ale ani na supporte hostingu mi nevedeli poradiť. Tu je časť z skriptu, na ktorom to taktiež nefunguje
Kód:
$dir = "../img/".$original."/";
$thumbdir = "../thumbs/".$original."/";
mkdir($dir); chmod($dir, 0777);
mkdir($thumbdir); chmod($thumbdir, 0777);
error_reporting(E_ALL);
// define the filename extensions
define('ALLOWED_FILENAMES', 'jpg|jpeg|gif|png');
// define a directory
define('IMAGE_DIR', $dir);
if($_FILES["zip_file"]["name"]) {
$filename = $_FILES["zip_file"]["name"];
$source = $_FILES["zip_file"]["tmp_name"];
$type = $_FILES["zip_file"]["type"];
$name = explode(".", $filename);
$accepted_types = array('application/zip', 'application/x-zip-compressed', 'multipart/x-zip', 'application/x-compressed');
foreach($accepted_types as $mime_type) {
if($mime_type == $type) {
$okay = true;
break;
}
}
$continue = strtolower(end($name)) == 'zip' ? true : false;
if(!$continue) {
$message = "The file you are trying to upload is not a .zip file. Please try again.";
}
$target_path = $dir.$filename;
if(move_uploaded_file($source, $target_path)) {
include("Zip.php");
$zip = new ZipArchive();
$x = $zip->open($target_path);
if ($x === true) {
$zip->extractTo($dir);
$zip->close();
unlink($target_path);
}
$message = "Your .zip file was uploaded and unpacked.";
} else {
$message = "There was a problem with the upload. Please try again.";
}
function createThumbs( $pathToImages, $pathToThumbs, $thumbWidth )
{
// open the directory
$dir = opendir( $pathToImages );
// loop through it, looking for any/all JPG files:
while (false !== ($fname = readdir( $dir ))) {
// parse path for the extension
$info = pathinfo($pathToImages . $fname);
// continue only if this is a JPEG image
if ( strtolower($info['extension']) == 'jpg' )
{
echo "Creating thumbnail for {$fname} <br />";
// load image and get image size
$img = imagecreatefromjpeg( "{$pathToImages}{$fname}" );
$width = imagesx( $img );
$height = imagesy( $img );
// calculate thumbnail size
$new_width = $thumbWidth;
$new_height = floor( $height * ( $thumbWidth / $width ) );
// create a new tempopary image
$tmp_img = imagecreatetruecolor( $new_width, $new_height );
// copy and resize old image into new image
imagecopyresized( $tmp_img, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height );
// save thumbnail into a file
imagejpeg( $tmp_img, "{$pathToThumbs}{$fname}" );
}
}
// close the directory
closedir( $dir );
}
createThumbs($dir,$thumbdir,100);
}
}