Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

Help! Image layering!

Links for php scripts

Moderators: macek, egami, gesf

Help! Image layering!

Postby redpenchill » Sat May 05, 2012 10:13 pm

I wrote this code to merge two images to gather but it gives me the error:
Warning: imagepng() [function.imagepng]: Unable to open 'images/ch5.png' for writing: Permission denied in D:\Hosting\9112579\html\skin.php on line 22 :-x

Code: Select all
<?php
function CombineImages($Images){
    echo "<div style='display:none;'>";
    for($CN=0;$CN<sizeof($Images);$CN++){
        $ext=strtolower(end(explode('.',$Images[$CN])));
            if($ext=="png"){$Images[$CN]=imagecreatefrompng($Images[$CN]);}
            elseif($ext=="gif"){$Images[$CN]=imagecreatefromgif($Images[$CN]);}
            elseif($ext=="jpg"||$ext=="jpeg"){$Images[$CN]=imagecreatefromjpeg($Images[$CN]);}
             imagealphablending($Images[$CN],true);imagesavealpha($Images[$CN],true);
    }
    $Image = false;
    for($CN=1;$CN<sizeof($Images);$CN++){$i1 = $Images[$CN-1];if($CN!=1){$i1 = $Image;}$i2 = $Images[$CN];
            imagecopyresampled($i1,$i2,0,0,0,0,imagesx($i1),imagesy($i1),imagesx($i2),imagesy($i2));
            imagepng($i1);
        $Image = $i1;}echo "</div> test";
return $Image;}


$image1 ="items/skin/skin1.png";
$image2 = "images/ch4noshirt.png";
$imagefin = CombineImages(Array($image1,$image2));
imagepng($imagefin,"images/ch5.png");

?>


:help:
redpenchill
New php-forum User
New php-forum User
 
Posts: 2
Joined: Sat May 05, 2012 10:08 pm

Re: Help! Image layering!

Postby macek » Sun May 06, 2012 5:33 am

Directory "images" do not have permissions to write that file (or file already exists and is not writeable for PHP)
User avatar
macek
php-forum Active User
php-forum Active User
 
Posts: 277
Joined: Wed Aug 25, 2010 10:42 am


Return to PHP Scripts

Who is online

Users browsing this forum: Google Feedfetcher and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.