Skip to content

Instantly share code, notes, and snippets.

View Chase-san's full-sized avatar

Chase-san

  • Detroit, USA
View GitHub Profile
@Chase-san
Chase-san / index.php
Last active December 12, 2015 02:18
A very tiny image gallery.
<?php /* Copyright(c) 2013 Robert Maupin. Released under the ZLIB License. */
if(count($_FILES) > 0) {
extract($_FILES['file']);
list($w,$h,$type)=getimagesize($tmp_name);
/*see exif-imagetype() documentation :) */
if(!$type||$type>3||filesize($tmp_name)>1024*200)
exit();
$ext=image_type_to_extension($type,false);
$md5=md5_file($tmp_name);
move_uploaded_file($tmp_name,$n="img/$md5.$ext");