View Full Version : PHP What could affect imagecopy()?
ahmednuaman
May 29th, 2008, 11:46 AM
I've created a function that's part of a class of image functions. The function in question replaces 'tiles' from a $source image on to a $dest image according to some $x, $y and $dimensions (it's a square so height and width are the same).
The weird thing is that if I run this function on one script, it runs fine. However, if I run the function on another script - bare in mind they're both getting the same variables - the output is different.
So what could affect imagecopy()?
sekasi
May 29th, 2008, 12:23 PM
Nothing really.
What about your destination resource? That's the only thing I can remotely think of, imagecopy is not reliant on any setting or any other class to function, and there's no auxiliary functions supporting it either..
ahmednuaman
May 29th, 2008, 12:33 PM
It's all fine. The thing that puzzles me is that one script, let's call it scriptA, executes the function and the output is correct, but another script, let's call it scriptB, executes the function and the output is different and incorrect.
There's no difference in the variables that are sent to them. They both have the same source and destination files, and the file being written to is delete prior to writing.
Weird or is it me?
ahmednuaman
May 29th, 2008, 01:14 PM
Damn spam. Also, I went about extracting the function from my class and putting it into a file by itself and running. It works perfectly fine. This is really strange. The file that's being read, ie the source is 76K - do you think that's affecting it? I tried adding a 1-2 second sleep() before it went about the imagecopy, but that did nothing.
sekasi
May 29th, 2008, 01:15 PM
^ spam
Well, it's really hard for me to understand how it could happen without actually seeing the files. Since you haven't posted them or any code I'm guessing it's 'confidential' one way or another.
Hard to troubleshoot though, but like I said, imagecopy doesn't rely on anything. Must be a difference in the way the destination resource is handled..
edit: nah, 76kb is not nearly enough for it to be a problem, but if it concerns you I would suggest running a few timers in the background to find out if there's a major difference in the time the script takes to execute..
ahmednuaman
May 30th, 2008, 05:57 AM
What bit of code would you like to see? The actual imagecopy() is run within a foreach() loop so it can't be cutting out half way.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.