whitespace and formatting
This commit is contained in:
parent
73b8de7c4c
commit
c1bc77efd9
|
@ -68,17 +68,17 @@ class ImageFile
|
||||||
static function fromUpload($param='upload')
|
static function fromUpload($param='upload')
|
||||||
{
|
{
|
||||||
switch ($_FILES[$param]['error']) {
|
switch ($_FILES[$param]['error']) {
|
||||||
case UPLOAD_ERR_OK: // success, jump out
|
case UPLOAD_ERR_OK: // success, jump out
|
||||||
break;
|
break;
|
||||||
case UPLOAD_ERR_INI_SIZE:
|
case UPLOAD_ERR_INI_SIZE:
|
||||||
case UPLOAD_ERR_FORM_SIZE:
|
case UPLOAD_ERR_FORM_SIZE:
|
||||||
throw new Exception(sprintf(_('That file is too big. The maximum file size is %d.'), $this->maxFileSize()));
|
throw new Exception(sprintf(_('That file is too big. The maximum file size is %d.'), $this->maxFileSize()));
|
||||||
return;
|
return;
|
||||||
case UPLOAD_ERR_PARTIAL:
|
case UPLOAD_ERR_PARTIAL:
|
||||||
@unlink($_FILES[$param]['tmp_name']);
|
@unlink($_FILES[$param]['tmp_name']);
|
||||||
throw new Exception(_('Partial upload.'));
|
throw new Exception(_('Partial upload.'));
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
throw new Exception(_('System error uploading file.'));
|
throw new Exception(_('System error uploading file.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -122,9 +122,9 @@ class ImageFile
|
||||||
&& $h === $this->height) {
|
&& $h === $this->height) {
|
||||||
|
|
||||||
$outname = Avatar::filename($this->id,
|
$outname = Avatar::filename($this->id,
|
||||||
image_type_to_extension($this->type),
|
image_type_to_extension($this->type),
|
||||||
$size,
|
$size,
|
||||||
common_timestamp());
|
common_timestamp());
|
||||||
$outpath = Avatar::path($outname);
|
$outpath = Avatar::path($outname);
|
||||||
@copy($this->filepath, $outpath);
|
@copy($this->filepath, $outpath);
|
||||||
return $outname;
|
return $outname;
|
||||||
|
@ -171,9 +171,9 @@ class ImageFile
|
||||||
imagecopyresampled($image_dest, $image_src, 0, 0, $x, $y, $size, $size, $w, $h);
|
imagecopyresampled($image_dest, $image_src, 0, 0, $x, $y, $size, $size, $w, $h);
|
||||||
|
|
||||||
$outname = Avatar::filename($this->id,
|
$outname = Avatar::filename($this->id,
|
||||||
image_type_to_extension($this->type),
|
image_type_to_extension($this->type),
|
||||||
$size,
|
$size,
|
||||||
common_timestamp());
|
common_timestamp());
|
||||||
|
|
||||||
$outpath = Avatar::path($outname);
|
$outpath = Avatar::path($outname);
|
||||||
|
|
||||||
|
@ -229,12 +229,12 @@ class ImageFile
|
||||||
$num = substr($str, 0, -1);
|
$num = substr($str, 0, -1);
|
||||||
|
|
||||||
switch(strtoupper($unit)){
|
switch(strtoupper($unit)){
|
||||||
case 'G':
|
case 'G':
|
||||||
$num *= 1024;
|
$num *= 1024;
|
||||||
case 'M':
|
case 'M':
|
||||||
$num *= 1024;
|
$num *= 1024;
|
||||||
case 'K':
|
case 'K':
|
||||||
$num *= 1024;
|
$num *= 1024;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $num;
|
return $num;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user