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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:16:20+00:00 2026-05-28T07:16:20+00:00

I need to first resize an image proportionally (the width is the important dimension)

  • 0

I need to first resize an image proportionally (the width is the important dimension) and then crop afterwards to chop of any excess height and then store the new version in a directory.

I’ve managed to do the resizing fine and I end up with images that are the correct width in my directory. Somehwere in here I need to crop the excess height off. But I can’t work out where I need to do it. Do I need to use copyimageresampled somehow. I want to crop all images so they’re 50px in height.

Here’s what I have so far fo the resizing:

$src = ImageCreateFromJpeg($upfile);
$dst = ImageCreateTrueColor($tn_width, $tn_height);
ImageCopyResized($dst, $src, 0, 0, 0, 0, $tn_width, $tn_height, $width, $height);
ImageJpeg($dst, 'images/' . $_FILES['image']['name']);
  • 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-28T07:16:21+00:00Added an answer on May 28, 2026 at 7:16 am

    This is what I was after. A 2 stage process. The trick is to resize the image in to a temporary image and then crop it:

    http://salman-w.blogspot.com/2009/04/crop-to-fit-image-using-aspphp.html

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

Sidebar

Related Questions

We need the ability to gracefully resize any photo/image to an exact width/height without
I need to do two things to an image: resize it, then crop it.
I need to perform java image crop and resize without an X server. I
I need to scale down an image that has a height or width greater
I need to change the mainwindow or the native app size width x height
$size1 = 170; $size2 = 128; if($width > $height){ exec(convert .$startfile. -resize x.$size2. -quality
I am painting an jpeg image using IPicture. At first I load it, then
I need to resize/crop images in different resolutions for Android App. I know, that
I need to get the first and last day of a month in the
I need to get just the first item (actually, just the first key) off

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.