I've been able to create and manipulate images from scratch but today I've been trying to manipulate an existing image and all I've been getting are confusing errors.

This is my code at this point:
CODE
<?php
            $image= imagecreatefrompng("animals/cat_normal.png");
            $image2= imagecreatefrompng("animals/cat_normal.png");
            $black= imagecolorallocate($image2, 0, 0, 0);
            $alpha= imagecolorallocatealpha($image2, 0, 0, 0, 127);
            imagefilltoborder($image2, 0, 0, $alpha, $black);
            imagepng($image2, "someimage.png");
            $newimage= imagecopymerge($image, $image2, 0, 0, 0, 0, 500, 455, 50);
            imagepng($newimage, "newimage.png");
            imagedestroy($image);
            imagedestroy($newimage);
?>


These are the errors this code gets:
QUOTE
Warning: imagepng() [function.imagepng]: Unable to open 'someimage.png' for writing: Permission denied in /www/zymichost.com/s/y/l/sylesca/htdocs/homestead/showanimal.phtml on line 7

Warning: imagepng(): supplied argument is not a valid Image resource in /www/zymichost.com/s/y/l/sylesca/htdocs/homestead/showanimal.phtml on line 9

Warning: imagedestroy(): supplied argument is not a valid Image resource in /www/zymichost.com/s/y/l/sylesca/htdocs/homestead/showanimal.phtml on line 11


If anyone could point out an error I've made I would really appreciate it because I am nearing the end of my rope trying to fix this script.