This repository was archived by the owner on Aug 7, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.php
More file actions
66 lines (57 loc) · 1.6 KB
/
index.php
File metadata and controls
66 lines (57 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
function watermark($image, $extension) {
$overlay = imagecreatefrompng('logo.png');
$opacity = "100";
// Set offset from bottom-right corner
$w_offset = 0;
$h_offset = 100;
// Load image from file
switch ($extension)
{
case 'image/jpeg':
$background = imagecreatefromjpeg($image);
break;
case 'image/png':
$background = imagecreatefrompng($image);
break;
case 'image/gif':
$background = imagecreatefromgif($image);
break;
default:
die("Only JPG, PNG, and GIF files can be made NSFW.");
}
// Find base image size
$bwidth = imagesx($background);
$bheight = imagesy($background);
// Turn on alpha blending
imagealphablending($background, true);
// Get the size of overlay
$owidth = imagesx($overlay);
$oheight = imagesy($overlay);
// Copy the overlay onto the background, $offset px from the bottom right corner.
$offset = 10;
imagecopy($background, $overlay, $bwidth - $owidth - $offset, $bheight - $oheight - $offset, 0, 0, $owidth, $oheight);
// Output to the browser
header("Content-Type: image/jpeg");
imagejpeg($background);
// Destroy the images
imagedestroy($background);
imagedestroy($overlay);
}
if (!empty($_FILES['image'])) {
watermark($_FILES['image']['tmp_name'], $_FILES['image']['type']);
die();
}
?>
<!DOCTYPE html>
<html lang='en'>
<head>
<title>NSFWify | Instantly make any image NSFW</title>
</head>
<body>
<form action="index.php" enctype="multipart/form-data" method="POST">
Choose a file to NSFWify: <input name="image" type="file" size="25" /><br>
<input type="submit" name="submit" value="NSFWify!" />
</form>
</body>
</html>