class counter {
var $count;
function getcount() {
return $this->count;
}
function getstep() {
return $this->step;
}
function nextbuilding($newval) {
if(is_integer($newval))
$this->step = $newval;
}
function step() {
$this->count += $this->step;
}
function reset() {
$this->count = 1;
$this->step = 1;
}
function create($building) {
$$building = imagecreatefrompng("..pad../{$this->count}.png");
imagecopy($im, ${$building}, 0, 0, 0, 0, imagesx(${$building}), imagesy(${$building}));
}
}
$query = mysql_query("
SELECT id,a,b,c,d,e,f,g,h,i,j,k,l,m
FROM blabla
");
$ranch = mysql_fetch_row($query);
$im = imagecreatefromjpeg("...pad....jpg");
$ticker = new counter();
$ticker->reset();
$ticker->nextbuilding(1);
while($ticker->getcount() <= 13)
{
$nr1 = $ticker->getcount();
$nr2 = $ranch[$nr1];
$test = array("1" => "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m");
if($nr2 == 'Y')
{
// wel laag maken
$ticker->create($test[$nr1]);
}
else
{
// geen laag maken
}
$ticker->step();
}
Hierna sla ik de afbeelding op en verwijder ik de afbeeldingen uit het geheugen.
Ik krijg echter steeds Warning: imagecopy() expects parameter 1 to be resource, null given
Waarom is parameter 1 geen resource?