PHP Thumb » Help & Bugs » Help

Were do you set the maximum size for the image upload??

(3 posts)
  1. jay
    Member

    Were do you set the maximum size for the image upload??

    Posted 8 months ago #
  2. Well, depends on how you're uploading images... Upload file size is, however, ultimately restricted at the php.ini level, but you can do so programmatically. Since the library doesn't have any official file upload support, that's about all I can do to help you, but there are tons of articles on file uploads in PHP out there.

    Posted 8 months ago #
  3. jay
    Member

    Hi Ian, thanks for the reply. When i upload a image around 1MB and above a get the following error message:


    Image file not found: ../../files/img_uploads/temp/P9240061.JPG"

    And here is my code, what it does is generates two resized images. I'am i missing out?

    require_once '../../core/classes/thumb/ThumbLib.inc.php';

    $options_thumb = array('resizeUp' => true, 'jpegQuality' => 30);
    $options_large = array('resizeUp' => true, 'jpegQuality' => 90);

    $filePath = '../../files/img_uploads/temp/'.$primaryImage;
    $tmpName = $_FILES["primary_image"]["tmp_name"];
    move_uploaded_file($tmpName,$filePath);

    $thumbDir = '../../files/img_uploads/thumbnail/';
    $largeDir = '../../files/img_uploads/large/';
    $random = rand(1000,9999);

    try{
    $thumb = PhpThumbFactory::create($filePath, $options_thumb);
    $large = PhpThumbFactory::create($filePath, $options_large);

    //Generate images
    thumb->resize(100, 100)->save("$thumbDir"."thumbnail_"."$uid"."_$random".".jpg");
    $large->resize(480, 480)->save("$largeDir"."large_"."$uid"."_$random".".jpg");

    $thumbPath = "$thumbDir"."thumbnail_"."$uid"."_$random".".jpg";
    $largePath = "$largeDir"."large_"."$uid"."_$random".".jpg";

    //Remove original image
    unlink($filePath);
    }

    catch (Exception $e){
    echo $e->getMessage();
    exit;
    }

    Posted 8 months ago #

RSS feed for this topic

Reply

You must log in to post.