From 4e4f91f83a3cbdfc240059bebadf852c1e5901cf Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Tue, 16 Jun 2009 11:40:49 +0000 Subject: made some improvements to image uploading --- actions/upload.php | 17 ++---- views/default/tidypics/forms/upload.php | 92 ++++++++++++++++----------------- 2 files changed, 50 insertions(+), 59 deletions(-) diff --git a/actions/upload.php b/actions/upload.php index 2e33d67db..a297128c4 100644 --- a/actions/upload.php +++ b/actions/upload.php @@ -115,16 +115,7 @@ $mem_avail = ini_get('memory_limit'); $mem_avail = rtrim($mem_avail, 'M'); $mem_avail = $mem_avail * 1024 * 1024; - if ($image_lib === 'GD') { - $mem_required = 5 * $imginfo[0] * $imginfo[1]; - $mem_avail = $mem_avail - memory_get_peak_usage() - 4194304; // 4 MB buffer - if ($mem_required > $mem_avail) { - array_push($not_uploaded, $sent_file['name']); - array_push($error_msgs, elgg_echo('tidypics:image_pixels')); - trigger_error('Tidypics warning: image memory size too large for resizing so rejecting', E_USER_WARNING); - continue; - } - } else if ($image_lib === 'ImageMagickPHP') { + if ($image_lib == 'GD') { $mem_required = 5 * $imginfo[0] * $imginfo[1]; $mem_avail = $mem_avail - memory_get_peak_usage() - 4194304; // 4 MB buffer if ($mem_required > $mem_avail) { @@ -133,6 +124,8 @@ trigger_error('Tidypics warning: image memory size too large for resizing so rejecting', E_USER_WARNING); continue; } + } else if ($image_lib == 'ImageMagickPHP') { + // haven't been able to determine a limit like there is for GD } //this will save to users folder in /image/ and organize by photo album @@ -160,13 +153,13 @@ } - if ($image_lib === 'GD') { + if ($image_lib == 'GD') { if (tp_create_gd_thumbnails($file, $prefix, $filestorename) != true) { trigger_error('Tidypics warning: failed to create thumbnails', E_USER_WARNING); } - } else if ($image_lib === 'ImageMagickPHP') { // ImageMagick PHP + } else if ($image_lib == 'ImageMagickPHP') { // ImageMagick PHP if (tp_create_imagick_thumbnails($file, $prefix, $filestorename) != true) { trigger_error('Tidypics warning: failed to create thumbnails', E_USER_WARNING); diff --git a/views/default/tidypics/forms/upload.php b/views/default/tidypics/forms/upload.php index ec33ca933..1d83cf311 100644 --- a/views/default/tidypics/forms/upload.php +++ b/views/default/tidypics/forms/upload.php @@ -11,58 +11,35 @@ $maxfilesize = 5; ?> - +
-

-
-
-

-
    +

    +
    +
    +

    + Uploading images
    +
    ...
    +
    +
      ' . elgg_view("input/file",array('internalname' => "upload_$x")) . "\n"; - } + for ($x = 0; $x < 10; $x++) { + echo '
    1. ' . elgg_view("input/file",array('internalname' => "upload_$x")) . '
    2. '; + } ?> -
    -

    - -

    - '; - if ($access_id) - echo ''; - ?> - " onclick="showhide('tidypics_loader');" /> -

    +
+

+

+'; + if ($access_id) + echo ''; +?> + " onclick="displayProgress();" /> +

'multipart/form-data', 'method' => 'post',)); ?> -
\ No newline at end of file + + \ No newline at end of file -- cgit v1.2.3