hi,
I have a really strange problem.
If I type the file names in the script, or the variables are in the script, the image is created, I can save it (save as) and when I view the source code it seems fine.
When I use variables that come from another script (via POST) the image is created, but I can't save it (I can, but can't open it) and when I view the source code I get a lot of errors:
<br />
<b>Warning</b>: imagecreatefromgif(../images/): failed to open stream: Permission denied in <b>c:\wamp\www\php\chicco\ecard\script\imagem.php</b> on line <b>34</b><br />
<br />
<b>Warning</b>: imagecreatefromgif(../images/): failed to open stream: Permission denied in <b>c:\wamp\www\php\chicco\ecard\script\imagem.php</b> on line <b>35</b><br />
<br />
<b>Warning</b>: imagecreatefromgif(../images/): failed to open stream: Permission denied in <b>c:\wamp\www\php\chicco\ecard\script\imagem.php</b> on line <b>36</b><br />
<br />
<b>Warning</b>: imagesx(): supplied argument is not a valid Image resource in <b>c:\wamp\www\php\chicco\ecard\script\imagem.php</b> on line <b>38</b><br />
<br />
<b>Warning</b>: imagesy(): supplied argument is not a valid Image resource in <b>c:\wamp\www\php\chicco\ecard\script\imagem.php</b> on line <b>38</b><br />
<br />
<b>Warning</b>: imagecopy(): supplied argument is not a valid Image resource in <b>c:\wamp\www\php\chicco\ecard\script\imagem.php</b> on line <b>38</b><br />
<br />
<b>Warning</b>: imagesx(): supplied argument is not a valid Image resource in <b>c:\wamp\www\php\chicco\ecard\script\imagem.php</b> on line <b>41</b><br />
<br />
<b>Warning</b>: imagesy(): supplied argument is not a valid Image resource in <b>c:\wamp\www\php\chicco\ecard\script\imagem.php</b> on line <b>41</b><br />
<br />
<b>Warning</b>: imagecopy(): supplied argument is not a valid Image resource in <b>c:\wamp\www\php\chicco\ecard\script\imagem.php</b> on line <b>41</b><br />
<br />
<b>Warning</b>: imagegif(): supplied argument is not a valid Image resource in <b>c:\wamp\www\php\chicco\ecard\script\imagem.php</b> on line <b>43</b><br />
<br />
<b>Warning</b>: imagedestroy(): supplied argument is not a valid Image resource in <b>c:\wamp\www\php\chicco\ecard\script\imagem.php</b> on line <b>45</b><br />
The php script:
<?php
header ("Content-type: image/gif");
// fundo
$fundo_im = $_POST['fundo_im'];
// boneco
$boneco_im = $_POST['boneco_im'];
$boneco_x = (int) $_POST['boneco_x'];
$boneco_y = $_POST['boneco_y'];
// acessorio
$acessorio_im = $_POST['acessorio_im'];
$acessorio_x = (int) $_POST['acessorio_x'];
$acessorio_y = (int) $_POST['acessorio_y'];
$fundo_im_res = imagecreatefromgif ('../images/' . $fundo_im);
$boneco_im_res = imagecreatefromgif ('../images/' . $boneco_im);
$acessorio_im_res = imagecreatefromgif ('../images/' . $acessorio_im);
imagecopy ($fundo_im_res, $boneco_im_res, $boneco_x, $boneco_y, 0, 0, imagesx ($boneco_im_res), imagesy ($boneco_im_res));
// adiciona outra imagem
imagecopy ($fundo_im_res, $acessorio_im_res, $acessorio_x, $acessorio_y, 0, 0, imagesx ($acessorio_im_res), imagesy ($acessorio_im_res));
imagegif($fundo_im_res);
imagedestroy ($fundo_im_res);
?>
The form to send the variables:
<form action="imagem.php" method="post" enctype="application/x-www-form-urlencoded">
<input name="fundo_im" type="hidden" id="fundo_im" value="sfondo_1.gif" />
<input name="boneco_im" type="hidden" id="boneco_im" value="personaggio_1.gif" />
<input name="boneco_x" type="hidden" id="boneco_x" value="0" />
<input name="boneco_y" type="hidden" id="boneco_y" value="0" />
<input name="acessorio_im" type="hidden" id="boneco_im" value="oggetto_1.gif" />
<input name="acessorio_x" type="hidden" id="boneco_x" value="0" />
<input name="acessorio_y" type="hidden" id="boneco_y" value="0" />
<input type="submit" name="Submit" value="Submit" />
</form>
All necessary files attached.