Answer the question
In order to leave comments, you need to log in
How to merge multiple images?
There is a mini-application where the user enters the group id and the number of group avatars to receive.
Here is the code:
index.php
<form action="group-count.php" method="POST">
<input type="text" name="id"/><br/>
<input type="number" min="10" name="count" max="1000" placeholder="Участники" requered/><br/>
<input type="submit"/>
</form>
<?php
array($_POST);
foreach($_POST as $k => $v)
$$k = $v;
$fields = "photo_50";
$group = json_decode(file_get_contents("http://api.vk.com/method/groups.getMembers?group_id=$id&fields=$fields&count=$count"), true);
foreach ($group['response']['users'] as $user) {
echo "<img src=\"".$user['photo_50']."\"/>";
}
?>
Answer the question
In order to leave comments, you need to log in
<?php
// шаблонное изображение
$dest = imagecreatefrompng('vinyl.png');
// обложка
$src = imagecreatefromjpeg('cover.jpg');
// настройка прозрачности и фильтров
imagealphablending($dest, false);
imagesavealpha($dest, true);
// объединение изображений
imagecopymerge($dest, $src, 10, 9, 0, 0, 181, 180, 100);
// сообщаем браузеру, что контент страницы будет image/png
header('Content-Type: image/png');
// отображаем изображение
imagepng($dest);
// очищаем память
imagedestroy($dest);
imagedestroy($src);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question