J
J
Jony13372015-10-18 15:57:07
PHP
Jony1337, 2015-10-18 15:57:07

What does this php code do?

What does this php code do I need to analyze it as a beginner I don't understand everything in php

<?php
$id = $_GET["id"];

$urlimg = 'http://i500.mycdn.me/getImage?photoId='.$_GET['urll'].'&type=6';

// Load the stamp and the photo to apply the watermark to
$stamp = imagecreatefrompng('new/'.$_GET["numm"].'.png');
$ran_dom = rand (1 , 2);
$im3 = imagecreatefromjpeg($urlimg);

imagecopy($im3, $stamp, 0, 0, 0, 0, 128, 128);

// Output and free memory
header("Content-Type: image/png");
imagepng($im3, 'images/'.$id.'.png');
imagedestroy($im3);
?>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivanq, 2015-10-18
@Jony1337

but how to put more watermarks there by default 1

<?php
$id = $_GET["id"];

$urlimg = 'http://i500.mycdn.me/getImage?photoId='.$_GET['urll'].'&type=6';

// Load the stamp and the photo to apply the watermark to
$stamp = imagecreatefrompng('new/'.$_GET["numm"].'.png');
$ran_dom = rand (1 , 2);
$im3 = imagecreatefromjpeg($urlimg);
imagecopy($im3, $stamp, 0, 0, 0, 0, 128, 128);

$im4 = imagecreatefromjpeg($urlimg); // Second watermark
imagecopy($im3, $im4, 0, 0, 0, 0, 128, 128);

// Output and free memory
header("Content-Type: image/png");
imagepng($im3, 'images/'.$id.'.png');
imagedestroy($im3);
?>

D
Dmitry Kuznetsov, 2015-10-18
@dima9595

As I understand it: Loads an image from the source, converts it to png and applies a watermark, and then displays the image.
Google Translate + knowledge of php = everything is clear and understandable)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question