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 7493915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T17:14:02+00:00 2026-05-29T17:14:02+00:00

I am having a very interesting problem. The script I wrote below works, but

  • 0

I am having a very interesting problem. The script I wrote below works, but it doesn’t work in Internet Explorer. The MAX_WIDTH variable is set to 450 and it still uploads the image with the original dimensions of the image, not 450 by whatever the conversion factor is. Any suggestions? It works and resizes in Chrome, Firefox, and Safari. Also, the version of IE I am testing on is IE 8 64-bit version. Thanks.

private function checkForResize() {
    $fileTypeArray = array('image/gif', 'image/jpeg', 'image/png');
    $origType = $this->_uploadType;
    if (in_array($origType, $fileTypeArray)) {
        $origImage = $_FILES[$this->_uploadInputField]['tmp_name'];
        $imageWidth = getimagesize($origImage);
        if ($imageWidth[0] > MAX_WIDTH) {
            // Resize here
            if ($origType == 'image/gif') {
                $imageSrc = imagecreatefromgif($origImage);
            } else if ($origType == 'image/jpeg') {
                $imageSrc = imagecreatefromjpeg($origImage);
            } else if ($origType == 'image/png') {
                $imageSrc = imagecreatefrompng($origImage);
            } else {
                return false;
            }
            $width = $imageWidth[0];
            $height = $imageWidth[1];
            $newHeight = ($height / $width) * MAX_WIDTH;
            $tmpImage = imagecreatetruecolor(MAX_WIDTH, $newHeight);
            $this->setTransparency($tmpImage, $imageSrc);
            imagecopyresampled($tmpImage, $imageSrc, 0, 0, 0, 0, MAX_WIDTH, $newHeight, $width, $height);
            imagejpeg($tmpImage, UPLOAD_DIR.DS.$this->_uploadSafeName, 100);
            imagedestroy($imageSrc);
            imagedestroy($tmpImage);
            return true;
        }
    }
    return false;
}
  • 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-29T17:14:07+00:00Added an answer on May 29, 2026 at 5:14 pm

    Converting my comment to an answer:

    The browser has nothing to do with server-side scripts going wrong, as it’s on the client side.

    What can be wrong, though, is the fact that MIME type is an unreliable information, for it’s the browser who detects and sends the MIME type.

    And IE sometimes sends an image/pjpeg or an image/x-png MIME type when dealing with jpgs or pngs, so you need to check those also when validating.

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

Sidebar

Related Questions

I'm having an interesting but difficult problem with my JavaScript code. Basically, I'm trying
Im having a very strange problem, i have a complicated view that returns incorrect
I am having a very strange problem with pound signs displaying incorrectly (or not
Ok, so I was having a very interesting issue with CakePHP 1.3, in that
I'm not yet a skilled programmer but I thought this was an interesting problem
Having a very basic problem here building/running a Java skeleton to make use of
I'm having a very odd problem that I can't seem to track down. Any
I am having a very weird CSRF protection problem in CodeIgniter. I have made
I'm having a very difficult time debugging a problem with an application I've been
We're having a very curious problem with hsqldb. We are running some tests which

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.