zeanwork / Watermark

Apply watermark image with PHP
44 stars 20 forks source link

function apply error #2

Open BixinLu opened 8 years ago

BixinLu commented 8 years ago

imagepng(): gd-png error: compression level must be 0 through 9 in watermark.php on line 206

slawa-dev commented 7 years ago

@bibom change save image in class

# Save image
if(preg_match('/^(.*)\.(jpeg|jpg)$/', $imgTarget)){
    $functionTarget($this->imgSource, $imgTarget, 100);
}elseif(preg_match('/^(.*)\.(png)$/', $imgTarget)){
    $functionTarget($this->imgSource, $imgTarget, 0);
}elseif(preg_match('/^(.*)\.(gif)$/', $imgTarget)){
    $functionTarget($this->imgSource, $imgTarget);
}
nimish1995 commented 7 years ago

I am getting this ERROR Fatal error: Function name must be a string in watermark.php on line 185

I am trying to upload and directly add to watermark function. Here is the Code:-

$watermark = new Watermark();
$temp_pimage=$_FILES["pimage"]["tmp_name"];
$watermark->apply($temp_pimage, $pimage, 'img/watermark.png', 4);}

Anyone can help me out what is the issue?

brainsucked commented 4 years ago

Add upper case file extensions in getFunction: if(preg_match("/^(.*)\.(jpeg|jpg|JPEG|JPG)$/", $name)){ etc.