Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 508639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:55:41+00:00 2026-05-13T06:55:41+00:00

So I am using the Uplodify plugin to allow users to upload multiple images

  • 0

So I am using the Uplodify plugin to allow users to upload multiple images at once. The problem is I need to set a minimum width and height for images. Let’s say 150x150px is the smallest image users can upload.

How can I set this limitation in the Uploadify plugin? When user tries to upload smaller picture, I would like to display some error message as well.

Here is the PHP file that is called bu the plugin to upload images:

<?php

define('BASE_PATH', substr(dirname(dirname(__FILE__)), 0, -22));

// set the include path
set_include_path(BASE_PATH
                 . '/../library'
                 . PATH_SEPARATOR
                 . BASE_PATH
                 . '/library'
                 . PATH_SEPARATOR
                 . get_include_path());

// autoload classes from the library
function __autoload($class) {
    include str_replace('_', '/', $class) . '.php';
}

$configuration = new Zend_Config_Ini(BASE_PATH
                                     . '/application'
                                     . '/configs/application.ini',
                                     'development');
$dbAdapter = Zend_Db::factory($configuration->database);
Zend_Db_Table_Abstract::setDefaultAdapter($dbAdapter);

function _getTable($table)
{
    include BASE_PATH
    . '/application/modules/default/models/'
    . $table
    . '.php';
    return new $table();
}

$albums = _getTable('Albums');
$media = _getTable('Media');

if (false === empty($_FILES)) {

    $tempFile = $_FILES['Filedata']['tmp_name'];
    $extension = end(explode('.', $_FILES['Filedata']['name']));

    // insert temporary row into the database
    $data = array();
    $data['type'] = 'photo';
    $data['type2'] = 'public';
    $data['status'] = 'temporary';
    $data['user_id'] = $_REQUEST['user_id'];
    $paths = $media->add($data, $extension, $dbAdapter);

    // save the photo
    move_uploaded_file($tempFile,
                       BASE_PATH . '/public/' . $paths[0]);

    // create a thumbnail
    include BASE_PATH . '/library/My/PHPThumbnailer/ThumbLib.inc.php';
    $thumb = PhpThumbFactory::create(BASE_PATH . '/public/' . $paths[0]);
    $thumb->adaptiveResize(85, 85);
    $thumb->save(BASE_PATH . '/public/' . $paths[1]);

    // add watermark to the bottom right corner
    $pathToFullImage = BASE_PATH . '/public/' . $paths[0];
    $size = getimagesize($pathToFullImage);
    switch ($extension) {
        case 'gif':
            $im = imagecreatefromgif($pathToFullImage);
            break;
        case 'jpg':
            $im = imagecreatefromjpeg($pathToFullImage);
            break;
        case 'png':
            $im = imagecreatefrompng($pathToFullImage);
            break;
    }
    if (false !== $im) {
        $white = imagecolorallocate($im, 255, 255, 255);
        $font = BASE_PATH . '/public/fonts/arial.ttf';
        imagefttext($im,
                    13, // font size
                    0, // angle
                    $size[0] - 132, // x axis (top left is [0, 0])
                    $size[1] - 13, // y axis
                    $white,
                    $font,
                    'HunnyHive.com');
        switch ($extension) {
            case 'gif':
                imagegif($im, $pathToFullImage);
                break;
            case 'jpg':
                imagejpeg($im, $pathToFullImage, 100);
                break;
            case 'png':
                imagepng($im, $pathToFullImage, 0);
                break;
        }
        imagedestroy($im);
    }

    echo "1";

}

And here’s the javascript:

$(document).ready(function() {    
    $('#photo').uploadify({
        'uploader'       : '/flash-uploader/scripts/uploadify.swf',
        'script'         : '/flash-uploader/scripts/upload-public-photo.php',
        'cancelImg'      : '/flash-uploader/cancel.png',
        'scriptData'     : {'user_id' : 'USER_ID'},
        'queueID'        : 'fileQueue',
        'auto'           : true,
        'multi'          : true,
        'sizeLimit'      : 2097152,
        'fileExt'        : '*.jpg;*.jpeg;*.gif;*.png',
        'wmode'          : 'transparent',
        'onComplete'     : function() {
            $.get('/my-account/temporary-public-photos', function(data) {
                $('#temporaryPhotos').html(data);
            });
        }
    });
    $('#upload_public_photo').hover(function() {
        var titles = '{';
        $('.title').each(function() {
            var title = $(this).val();
            if ('Title...' != title) {
                var id = $(this).attr('name');
                id = id.substr(5);
                title = jQuery.trim(title);
                if (titles.length > 1) {
                    titles += ',';
                }
                titles += '"' + id + '"' + ':"' + title + '"';
            }
        });
        titles += '}';
        $('#titles').val(titles);
    });
});

Now bear in mind that I know how to check images dimensions in the PHP file. But I’m not sure how to modify the javascript so it won’t upload images with very small dimensions.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:55:41+00:00Added an answer on May 13, 2026 at 6:55 am

    You get the size of the image on this line:

    $size = getimagesize($pathToFullImage);
    

    Why not add a conditional here to check if it is at least the size you want, and if not return an error.

    if($size[0] > 150 || $size[1] > 150) {
      return $someError;
    }
    

    Also it looks like there is an onError option for Uploadify which you could set: http://www.uploadify.com/documentation/

    EDIT: This thread looks like it could be of some help to you: http://www.uploadify.com/forum/viewtopic.php?f=5&t=14

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 366k
  • Answers 366k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Don't see anything wrong here, i'd look at how you… May 14, 2026 at 4:30 pm
  • Editorial Team
    Editorial Team added an answer two approaches - if you need to open and modify… May 14, 2026 at 4:30 pm
  • Editorial Team
    Editorial Team added an answer If you search for 'Test (Test)' and you want to… May 14, 2026 at 4:30 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.