473,396 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

PHP: imagecopy problem

Hey all,

I'm trying to use imagecopy for creating a JPEG which is a part of the
original picture.
The problem is that when I give the width, height, X and Y it creates
an image which isn't the part i like to crop.
Here is the code:

function crop_jpeg_image($x1,$y1,$w,$h,$image,$quality=95){
$srcImage=imagecreatefromjpeg($image);
if($srcImage==''){
return FALSE;
}

$destImage=imagecreatetruecolor($w,$h);

imagecopy($destImage,$srcImage,0,0,$x1,$y1,$w,$h);

if(!imagejpeg($destImage,$image,$quality)){
return FALSE;
}

imagedestroy($destImage);
imagedestroy($srcImage);

return TRUE;
}

Is there anyone who can explain me what the problem can be?

Thanks in advance,

Lucas.

Feb 15 '07 #1
0 1477

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Michel | last post by:
I am trying to display a position, on a chessboard, corresponding to a sequence of moves recorded in a MySql database. Any clue? Michel
5
by: news | last post by:
Hi, I am pretty new to PHP I want to do the following but I have been unable to find good info/ or sample code on it; please help; - retrieve a gif/jpeg image using PHP from another site -...
12
by: bhennon | last post by:
Hey all, I have a small php script that calls a random image at the following page. http://www.2006ymcanationals.com/random.php IT WORKS IF I go directly to the above link. I am trying to...
7
by: Ubantu Rococo | last post by:
Hi all, Sorry for this stupid question, but I am having trouble mixing imagecopy etc. with HTML. What I am trying to do is copy an image, and then obtain co-ordinates from a database which will...
1
by: Hemanth | last post by:
Hello, Could anyone throw some light on the following questions, please? 1) How can I add a hyperlink to an image file generated using GD library? For eg., I'm using ImageString(...) function...
3
by: Manish | last post by:
I am developing a photo gallery. 1. The user will be able to upload the photo a) Edit the photo using various GD library functions viz. flip, rotate, ... 2. AJAX is implemented in a small...
4
by: comp.lang.php | last post by:
Recap: Using imagerotate within PHP 4.3.9 - PHP 5.2.0 for both XP and Linux, all using GD2 If you rotate an image 180 degrees, all is fine If you rotate an image 0 degrees and < 180...
0
by: nirav009 | last post by:
Hi, i would like to know, how we can reduce the ImageCopy Job run time. The job is usually taking almost 2hours for approximate 6M records. Ofcourse it is run through Utility, but is there any...
3
by: kksandeep | last post by:
i am using this three files to uplod file. i got this file from net but i think these have some error. i am new to this field plz help the script i found is some helpful but not too that i need ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.