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

  • Home
  • SEARCH
  • 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 7844735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:59:03+00:00 2026-06-02T16:59:03+00:00

I found a free picture upload script on the webby, but it only allows

  • 0

I found a free picture upload script on the webby, but it only allows JPG/JPEG formats.

How do I allow it to upload format PNG and BMP?

for($i=0;$i<count($_FILES["fileUpload"]["name"]);$i++)  
{  
    if(trim($_FILES["fileUpload"]["tmp_name"][$i]) != "")  
    {  
        $images = $_FILES["fileUpload"]["tmp_name"][$i];  
        $new_images = "thumbnails_".$_FILES["fileUpload"]["name"][$i];  
        copy($_FILES["fileUpload"]["tmp_name"][$i],"PIC_FOLDER".$_FILES["fileUpload"]["name"][$i]);  
        $width=100; //*** Fix Width & Heigh (Autu caculate) ***//  
        $size = GetimageSize($images);  
        $height = round($width*$size[1]/$size[0]);  
        $images_orig = ImageCreateFromJPEG($images);  
        $photoX = ImagesX($images_orig);  
        $photoY = ImagesY($images_orig);  
        $images_fin = ImageCreateTrueColor($width, $height);  
        ImageCopyResampled($images_fin, $images_orig, 0, 0, 0, 0, $width+1, $height+1, $photoX, $photoY);  
        ImageJPEG($images_fin,"PIC_FOLDER".$new_images);  
        ImageDestroy($images_orig);  
        ImageDestroy($images_fin);  

        echo "Resize Successful.<br>";
    }  
}  

Thanks in advance

  • 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-06-02T16:59:04+00:00Added an answer on June 2, 2026 at 4:59 pm

    As the comment says you already are able to upload any type but you need it to be a jpeg to be able to make the thumbnail. Simply do a check on the type then use that to open the image

        $src= $images;
        $image_info = @getimagesize($src);
        list($imgwidth,$imgheight,$image_type) = $image_info;
        if( $image_type == IMAGETYPE_JPEG ) {
            $images_orig    = @imagecreatefromjpeg($src);
        } else if( $image_type == IMAGETYPE_GIF ) {
            $images_orig    = @imagecreatefromgif($src);
        } else if( $image_type == IMAGETYPE_PNG ) {
            $images_orig    = @imagecreatefrompng($src);
        } else if( $image_type == IMAGETYPE_BMP ) {
            $images_orig    = @imagecreatefrombmp($src);
        }
    

    just use this instead of $images_orig = ImageCreateFromJPEG($images);

    If you also want to save the images back in whatever format they came in as, do a similar check at the bottom instead of ImageJPEG($images_fin,”PIC_FOLDER”.$new_images);

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

Sidebar

Related Questions

I tried using a free script that I found on the Internet but it
I found a free program on the web that was .NET 4.0, but had
Salvete! Whilst searching for a quality, free asp.net/ajax upload control, I found NeatUpload. I
Requirements: free, preferably open-source implemented in one of the .NET managed langs Google found
I haven't found this question, feel free to close if it's already up here.
I've looked at free javascript html editors, and I haven't found any that I
Found this: Sub SurroundWithAppendTag() DTE.ActiveDocument.Selection.Text = .Append( + DTE.ActiveDocument.Selection.Text + ) End Sub But
I found out that if my application has much free memory available it uses
from some code I found in Sacha Barbers free mvvm framework chinch I saw
Are there any good (preferably free) solutions out there? I have already found these:

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.