Skip to content

Instantly share code, notes, and snippets.

@Laim
Created September 30, 2016 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Laim/6036d6983b6042c5a6cd58c7a5309c41 to your computer and use it in GitHub Desktop.
Save Laim/6036d6983b6042c5a6cd58c7a5309c41 to your computer and use it in GitHub Desktop.
i was tired and made this and i decided to use it but i really need to change it, soz whoever sees this
<?php
if($get_image) {
if(strpos($get_image, '.png') == true) {
$get_image = str_replace('.png','',$get_image);
}
if($image_functions->get_image_for_check($get_image) == 'false') {
if(file_exists("images/$get_image.png")) {
$image_file_name = md5(time());
rename($image_dir . "/" . $get_image . ".png", $image_dir . "/" . $image_file_name . ".png");
list($width, $height) = getimagesize($image_dir . "/" . $image_file_name . ".png"); // Image Dimensions
$image_filesize = filesize($image_dir . "/" . $image_file_name . ".png"); // Image Filesize
$image_functions->insert_image($userid, $get_image, $image_file_name, $width, $height, $image_filesize, '0', '0');
$image_show = "//domain.com/images/" . $image_file_name;
} else {
header("HTTP/1.1 404 Not Found");
include("errors/404.php");
die();
}
} elseif ($image_functions->get_image_for_check($get_image) == 'true') {
if($image_functions->get_direct_image_name($get_image) == 'false') {
$image_show = "//domain.com/images/" . $image_functions->get_image_name($get_image)[0]['ImageName'];
} else {
header("HTTP/1.1 404 Not Found");
include("errors/404.php");
die();
}
}
} else {
header("HTTP/1.1 404 Not Found");
include("errors/404.php");
die();
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment