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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:29:56+00:00 2026-06-07T05:29:56+00:00

My upload/crop function is working almost how I want it. Except Im having to

  • 0

My upload/crop function is working almost how I want it. Except Im having to refresh my page to show the uploaded image..And then when I delete the image using the delete button futher down my code, I get the following 2 errors showing in my header. And the upload form doesn’t show up again unless I refresh the page, then the following errors dissapear from view until I delete the uploaded image again.

Here is the two errors and then the code with the getimagesize functions marked as bold.

  Warning: getimagesize(imgs/pic7.jpg) [function.getimagesize]: failed to open stream: No such file or directory in ----- on line 48

    Warning: getimagesize(imgs/pic7.jpg) [function.getimagesize]: failed to open stream: No such file or directory in ------ 42

This is the area of the issue with the two errors marked as bold –

$id=$_SESSION['id'];
$upload_dir = "imgs";               // The directory for the images to be saved in
$upload_path = $upload_dir."/";             // The path to where the image will be saved
$large_image_name = "pic".$id.".jpg";       // New name of the large image
$thumb_image_name = "cropped".$id.".jpg"; 
$max_file = "1148576";                      // Approx 1MB
$max_width = "500";                         // Max width allowed for the large image
$thumb_width = "100";                       // Width of thumbnail image
$thumb_height = "100";                      // Height of thumbnail image

//Image functions
//You do not need to alter these functions
function resizeImage($image,$width,$height,$scale) {
    $newImageWidth = ceil($width * $scale);
    $newImageHeight = ceil($height * $scale);
    $newImage = imagecreatetruecolor($newImageWidth,$newImageHeight);
    $source = imagecreatefromjpeg($image);
    imagecopyresampled($newImage,$source,0,0,0,0,$newImageWidth,$newImageHeight,$width,$height);
    imagejpeg($newImage,$image,90);
    chmod($image, 0777);
    return $image;
}
//You do not need to alter these functions
function resizeThumbnailImage($thumb_image_name, $image, $width, $height, $start_width, $start_height, $scale){
    $newImageWidth = ceil($width * $scale);
    $newImageHeight = ceil($height * $scale);
    $newImage = imagecreatetruecolor($newImageWidth,$newImageHeight);
    $source = imagecreatefromjpeg($image);
    imagecopyresampled($newImage,$source,0,0,$start_width,$start_height,$newImageWidth,$newImageHeight,$width,$height);
    imagejpeg($newImage,$thumb_image_name,90);
    chmod($thumb_image_name, 0777);
    return $thumb_image_name;
}
//You do not need to alter these functions
function getHeight($image) {
    **$sizes = getimagesize($image);**
    $height = $sizes[1];
    return $height;
}
//You do not need to alter these functions
function getWidth($image) {
    **$sizes = getimagesize($image);**
    $width = $sizes[0];
    return $width;
}
  • 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-07T05:29:59+00:00Added an answer on June 7, 2026 at 5:29 am

    Calling getimagesize($image) on deleted image of course should give you error. Check if file exists before calling getimagesize($image) with file_exists($file_path) function.

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

Sidebar

Related Questions

i am trying to upload image in yii and then crop the uploaded image
I want to upload an image to a model and then crop it. I
I am having an upload image system. You upload a image, then you crop
I'm building functionality that allows users to upload an image, then crop it to
I want to create a function that after an image upload, will allow a
I want to upload and crop an image via ajax. Please suggest how I
I have this upload then you can crop your image, but if you press
I am looking to do a client side image crop/scale (creating thumbnails) then upload
I want to allow users upload an image through the Django admin, crop and
I'm trying to develop image crop using JQuery. I use ajax to upload the

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.