Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to merge multiple images together using GD library?
    primarykey
    data
    text
    <p>I have removed my original question as I have managed to partially get this working, what I have is 7 images, </p> <p><a href="https://dl.dropboxusercontent.com/u/58586640/layer1.png" rel="nofollow">https://dl.dropboxusercontent.com/u/58586640/layer1.png</a> <a href="https://dl.dropboxusercontent.com/u/58586640/layer2.png" rel="nofollow">https://dl.dropboxusercontent.com/u/58586640/layer2.png</a> <a href="https://dl.dropboxusercontent.com/u/58586640/layer3.png" rel="nofollow">https://dl.dropboxusercontent.com/u/58586640/layer3.png</a> <a href="https://dl.dropboxusercontent.com/u/58586640/layer4.png" rel="nofollow">https://dl.dropboxusercontent.com/u/58586640/layer4.png</a> <a href="https://dl.dropboxusercontent.com/u/58586640/layer5.png" rel="nofollow">https://dl.dropboxusercontent.com/u/58586640/layer5.png</a> <a href="https://dl.dropboxusercontent.com/u/58586640/layer6.png" rel="nofollow">https://dl.dropboxusercontent.com/u/58586640/layer6.png</a> <a href="https://dl.dropboxusercontent.com/u/58586640/layer7.png" rel="nofollow">https://dl.dropboxusercontent.com/u/58586640/layer7.png</a></p> <p>Each of these images when placed over the top of each other should create one image that slots together perfectly.</p> <p>The current result i have is, </p> <p><a href="https://dl.dropboxusercontent.com/u/58586640/Screen%20Shot%202013-12-11%20at%2018.31.57.png" rel="nofollow">https://dl.dropboxusercontent.com/u/58586640/Screen%20Shot%202013-12-11%20at%2018.31.57.png</a></p> <p>As you can see it works nearly perfectly but 2 of the layers are either not being copied or are not getting the alphas saved correctly. I am not sure what I am doing wrong, as all the other layers seem to working fine, the images that are coming in as black are, </p> <p><a href="https://dl.dropboxusercontent.com/u/58586640/layer3.png" rel="nofollow">https://dl.dropboxusercontent.com/u/58586640/layer3.png</a> <a href="https://dl.dropboxusercontent.com/u/58586640/layer4.png" rel="nofollow">https://dl.dropboxusercontent.com/u/58586640/layer4.png</a></p> <p>Here is my current code, </p> <pre><code> &lt;?php $images = array('img/layer1.png', 'img/layer2.png', 'img/layer3.png', 'img/layer4.png', 'img/layer5.png', 'img/layer6.png', 'img/layer7.png'); // foreach($images as $i) { // var_dump(file_exists($i)); // } // Allocate new image $img = imagecreatetruecolor(704, 469); // Make alpha channels work imagealphablending($img, true); imagesavealpha($img, true); foreach($images as $fn) { // Load image $cur = imagecreatefrompng($fn); imagealphablending($cur, true); imagesavealpha($cur, true); // Copy over image imagecopy($img, $cur, 0,0,0,0, 704, 469); // Free memory imagedestroy($cur); } header('Content-Type: image/png'); imagepng($img); </code></pre> <p>As you can see I have checked to make sure that the files exist, and they do so it must be GD problem, anyone have ideas?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload