bubbles Posted October 6, 2013 Report Posted October 6, 2013 Am urmatoarele bucati de imagini :<div id="img_final"><img src="1.jpg"><img src="2.jpg"><img src="3.jpg"> <br/><img src="4.jpg"><img src="5.jpg"><img src="6.jpg"> <br/><img src="7.jpg"><img src="8.jpg"><img src="9.jpg"> <br/></div>Care impreuna asezate ca sus formeaza o poza mare, poza de care am nevoie. Cum as putea salva automat pozele doar intr-o singura poza ?Ma intereseaza in PHP. Quote
GarryOne Posted October 6, 2013 Report Posted October 6, 2013 imagealphablending($image, true);for ($i = 0; $i < count($layers); $i++) { imagecopymerge($image, $layers[$i], 0, 0, 0, 0, $width, $height, 100);}imagealphablending($image, false);imagesavealpha($image, true); Quote
H3xoR Posted October 6, 2013 Report Posted October 6, 2013 (edited) <!DOCTYPE html><html> <head> <title>Merge Image</title> <script src="merge.js"></script> </head> <body> <div id="img_final"> <img src="1.jpg"><img src="2.jpg"><img src="3.jpg"> <br/> <img src="4.jpg"><img src="5.jpg"><img src="6.jpg"> <br/> <img src="7.jpg"><img src="8.jpg"><img src="9.jpg"> <br/> </div> </body></html>document.addEventListener("readystatechange", function(e) { if (document.readyState == "complete") { var imgs = document.getElementById("img_final"); var w = 0, h = 0; var a = 0, b = 0; for (var i = 0; i < imgs.childNodes.length; i++) if (imgs.childNodes.tagName == "IMG") { if (w < imgs.childNodes.width) w = imgs.childNodes.width; if (h < imgs.childNodes.height) h = imgs.childNodes.height; a++; } else if (imgs.childNodes.tagName == "BR") b++; var canvas = document.createElement("canvas"); canvas.width = w * a / b; canvas.height = h * b; var x = 0, y = 0; var ctx = canvas.getContext("2d"); for (var i = 0; i < imgs.childNodes.length; i++) if (imgs.childNodes.tagName == "IMG") { ctx.drawImage(imgs.childNodes, x, y); x += w; } else if (imgs.childNodes.tagName == "BR") { y += h; x = 0; } var uri = encodeURIComponent(canvas.toDataURL("image/jpg")); //alert(uri); }});L-am f?cut in javascript.. po?i trimite URI prin ajax (post) ?i s?-l salvezi într-o baz? de date.Baft?! Edited October 6, 2013 by H3xoR Quote