function processImagesInOneDirection($name, $array, \SplFileInfo $colorDirectory) { /** * @var string $direction * @var string[] $oneDirectionImages */ foreach ($array as $direction => $oneDirectionImages) { mergeImages($name, $direction, array_slice($oneDirectionImages, 0, 4), $colorDirectory, '-part1'); mergeImages($name, $direction, array_slice($oneDirectionImages, 4, 4), $colorDirectory, '-part2'); mergeImages($name, $direction, $oneDirectionImages, $colorDirectory, ''); } }
function createThumbNail($im, $dimension, $format) { if ($format === "png") { $thumb = createImage($dimension, $dimension); } else { $thumb = createImage($dimension, $dimension, true, "white"); } //$dimension = $dimension - 2; // as we add a border of 1px if (isPortrait($im)) { $resized = scaleImageToHeight($im, $dimension); } else { $resized = scaleImageToWidth($im, $dimension); } //$resized = borderImage($resized,1); $final_thumb = mergeImages($thumb, $resized, Imagick::COMPOSITE_DEFAULT, 0, 0, Imagick::GRAVITY_CENTER); //$final_thumb = borderImage($final_thumb,1); //$thumb->destroy(); //$resized->destroy(); return $final_thumb; }
flush(); foreach ($images as $k => $image) { $image = $link->getImageLink($productObj->link_rewrite, $image['id_image'], 'thickbox'); $image = (int) preg_replace('/\\D/', '', $image); $str = str_split($image); $filepath = "/var/www/indusdiva.com/img/p/"; $filepath = $filepath . implode("/", $str) . "/" . $image . "-thickbox.jpg"; $new_filename = "{$id_product}_{$count}.jpg"; $new_filename = "/var/www/indusdiva.com/gosf-images/" . $new_filename; $source_gd_image = createImageFromFile($filepath); $new_width = 483; $new_height = 660; $dest_gd_image = scaleImageToHeight($source_gd_image, $new_height); $background = createImage(990, 660); $background = mergeImages($background, $dest_gd_image, Imagick::COMPOSITE_DEFAULT, 0, 0, Imagick::GRAVITY_CENTER); $background->setImageFormat('jpg'); $background->writeImage($new_filename); $source_gd_image->destroy(); $dest_gd_image->destroy(); $background->destroy(); $count++; } } //LOGO $filepath = "/home/venu/Logo.jpg"; $source_gd_image = createImageFromFile($filepath); $dest_gd_image = scaleImageToWidth($source_gd_image, 990); $background = createImage(990, 660); $background = mergeImages($background, $dest_gd_image, Imagick::COMPOSITE_DEFAULT, 0, 0, Imagick::GRAVITY_CENTER); $background->setImageFormat('jpg'); $background->writeImage('/var/www/indusdiva.com/gosf-images/logo.jpg');
if ($src) { if (!is_array($src) && strpos($src, "+") !== FALSE) { $src = explode("+", $src); } if (is_array($src) && count($src) > 1) { $results = array(); foreach ($src as $key => $url) { if (empty($url)) { continue; } $res = saveFileByURL($url); if (!empty($res)) { $results[] = $res; } } $result = mergeImages($results); } else { if (is_array($src) && count($src) == 1) { $src = $src[0]; } $result = saveFileByURL($src); } extract($result); } elseif (isset($_FILES['fileRaw']) && ($fileRaw = $_FILES['fileRaw'])) { // file upload //$data = file_get_contents($fileRaw['tmp_name']); if (!isset($_FILES['fileRaw']['tmp_name']) || empty($_FILES['fileRaw']['tmp_name'])) { throw new Exception("File upload failed (tmp_name is missing)"); } $hash = hash_file('sha256', $fileRaw['tmp_name']); $imgType = exif_imagetype($fileRaw['tmp_name']);
while ($row = $rsMyArtefacts->fetch_array()) { ?> <tr> <td class="gen" align="center"><?php echo $i++; ?> </td> <td class="gen"><input type="checkbox" id="selID" name="selID[]" value="<?php echo $row["player_artefact_id"]; ?> "></td> <td class="gen"> <?php $imgFile = substr($row["artefact_size_img"], 0, strlen($row["artefact_size_img"]) - 4) . "_" . substr($row["artefact_type_img"], 0, strlen($row["artefact_type_img"]) - 4) . ".gif"; if (!file_exists($imgFile)) { mergeImages($row["artefact_size_img"], $row["artefact_type_img"]); } ?> <img src="img/<?php echo $imgFile; ?> "> <?php echo $row["artefact_size_name"] . " альянсовый артефакт " . $row["artefact_type_name"]; ?> </td> <td class="gen"> <img src="img/<?php echo $row["resource_img"]; ?> ">