Это мой класс php для объединения с изображениями
mergepic.php
class mergepic{ public function merge_barchart_drawing($object,$obj) { $src = imagecreatefrompng($obj->barchart()); $dest = imagecreatefrompng($object->drawing()); //$src = imagecreatefrompng('http://localhost/graph/barchart.php?barchart='.$_GET['barchart'].'&max='.$_GET['max'].'&digit='.$_GET['digit']); //$dest = imagecreatefrompng('http://localhost/graph/drawing.php?drawings='.$_GET['drawings'].'&max='.$_GET['max'].'&digit='.$_GET['digit']); imagealphablending($dest, false); imagesavealpha($dest, true); imagecopymerge($dest, $src, 10, 9, 0, 9, 700, 500, 100); //have to play with these numbers for it to work for you, etc. header('Content-Type: image/png'); imagepng($dest); imagedestroy($dest); imagedestroy($src); } }
creating_obj, PHP
<? include('drawing.php'); include('barchart.php'); include('mergepic_class.php'); $draw = new drawgraph(); $barchart = new barchart_graph(); $merge_draw = new mergepic(); $merge_draw_bar = $merge_draw->merge_barchart_drawing($draw,$barchart); ?>
в<? include('drawing.php'); include('barchart.php'); include('mergepic_class.php'); $draw = new drawgraph(); $barchart = new barchart_graph(); $merge_draw = new mergepic(); $merge_draw_bar = $merge_draw->merge_barchart_drawing($draw,$barchart); ?>
в<? include('drawing.php'); include('barchart.php'); include('mergepic_class.php'); $draw = new drawgraph(); $barchart = new barchart_graph(); $merge_draw = new mergepic(); $merge_draw_bar = $merge_draw->merge_barchart_drawing($draw,$barchart); ?>
в<? include('drawing.php'); include('barchart.php'); include('mergepic_class.php'); $draw = new drawgraph(); $barchart = new barchart_graph(); $merge_draw = new mergepic(); $merge_draw_bar = $merge_draw->merge_barchart_drawing($draw,$barchart); ?>
Если я запустил createing_obj.php, я получаю только один файл изображения, не объединяя два изображения. Вместо класса, если я использую url внутри imagecreatefrompng()
он работает нормально.
Любая идея, пожалуйста?