Jump to content

Cannot Redeclare Error ):


ajicles

Recommended Posts

I have my script that was working before I added a function to error trap different file extensions and I got an error and I can't figure it out. And I was wondering how I could just add the watermark to the image and just save it.

 

Thanks

~AJ

 

<?php
$filename = @$_GET['image'];
$filename = 'images/'.$filename.'';
$ext = end(explode('.', $filename));
$ext = strtolower($ext);

function HEADER(&$ext){ 
if ($ext == 'png'){
header('Content-Type: image/png');
}
elseif($ext == 'bmp'){
header('Content-Type: image/png');
}
elseif($ext == 'jpeg'){
header('Content-Type: image/png');
}
elseif($ext == 'jpg'){
header('Content-Type: image/png');
}
elseif($ext == 'gif'){
header('Content-Type: image/png');
}
else
{
echo 'I do not know that file extenstion ';
}
}

function DEST(&$ext){
if ($ext == 'png'){
$dest = imagecreatefrompng($filename);
}
elseif($ext == 'bmp'){
$dest = imagecreatefrombmp($filename);
}
elseif($ext == 'jpeg'){
$dest = imagecreatefromjpeg($filename);
}
elseif($ext == 'jpg'){
$dest = imagecreatefromjpg($filename);
}
elseif($ext == 'gif'){
$dest = imagecreatefromgif($filename);
}
else
{
echo 'I do not know that file extenstion ';
}
}

$watermark = 'watermark.gif';
DEST($ext);
$src = imagecreatefromgif($watermark);


list($width, $height, $type, $attr)=getimagesize($filename);

$markwidth = 86;
$markheight = 20;
$opacity = 35;
imagecopymerge($dest, $src, ($width-$markwidth)>>1, ($height-$markheight)>>1, 0, 0, $markwidth, $markheight, $opacity);

header($IMG);
imagegif($dest);

imagedestroy($dest);
imagedestroy($src);

Link to comment
https://forums.phpfreaks.com/topic/208117-cannot-redeclare-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.