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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:59:40+00:00 2026-05-22T17:59:40+00:00

So I have a user image and a user specified point of interest based

  • 0

So I have a user image and a user specified point of interest based off of that image.

I have retrieved that point of interest from a XML file and put them into variables so I have 2 points.

x= 246
y= 73

My question: How can I crop a 45 by 53 thumbnail image with the above coordinates being the center-point of the thumbnail? I don’t want the image to scale at all, just crop.

  • 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-22T17:59:41+00:00Added an answer on May 22, 2026 at 5:59 pm

    With GD it should work this way:

    // Open source image
    $srcImg = imagecreatefromjpeg ( $filename );
    
    // Create new image for the cropped version
    $destImg = imagecreate ( 45, 53 );
    
    // Calculate the upper left of the image-part we want to crop
    $startX = x - 45 / 2;
    $startY = y - 53 / 2;
    
    // Copy image part into the new image
    imagecopy ( $destImg, $srcImg , 0, 0, $startX, $startY, 45, 53 );
    
    // Write the new image with quality 90
    imagejpeg($destImg, 'newfile.jpg', 90);
    

    You might want to check for rounded coordinates as your image might blur if you don’t. You should check if your cropped image coordinates are well within your original image if the user lets say chooses a corner as poi.

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

Sidebar

Related Questions

I have a requirement to verify that a user-specified URL is to an image.
I have an app that allows the user to choose an image, at design
I have a website going that takes a user's uploaded image, and makes three
I have a simple page with images, and when the user clicks the image,
I have an image on my page and when the user hovers over it
I have a textbox where user will enter the url of the image :
I have a button and image inside it in my silverlight user control. When
I have a form which takes both the user details and an image uploaded
I have an aspx page,where the user will enter a valid image url(ex :
I have a webpage where I want the user to see a new image

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.