5) { $ok = false; } //checks if the form has been submitted if($ok && isset($_FILES['upload'])) { //reads the name of the file the user submitted for uploading $image=$_FILES['upload']['name']; //if it is not empty if ($image) { //get the original name of the file from the clients machine $filename = stripslashes($_FILES['upload']['name']); //get the extension of the file in a lower case format $extension = getExtension($filename); $extension = strtolower($extension); //if it is not a known extension, we will suppose it is an error and will not upload the file, //otherwise we will do more tests if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif")) { //print error message echo '

Unknown extension!

'; $errors=1; } else { if (isset($_POST['name']) ) { $name = makesafe($_POST['name']); } else { $name = ""; } if (isset($_POST['title']) ) { $title = makesafe($_POST['title']); } else { $title = ""; } if (isset($_POST['description']) ) { $tags = makesafe($_POST['description']); } else { $tags = ""; } $q = "select count(*) as c from momae where ip = '".$ip."' and title ='".$title."' AND name = '".$name."' AND description = '".$description."' limit 1"; $res = mysql_query($q); $row = mysql_fetch_assoc($res); $ok = true; if ($row['c'] > 0) { $ok = false; } if ($ok) { $q = "insert into momae (name, title, description, exif, flag, moment, ip) VALUES ('".$name."','".$title."','".$description."','".$exif."','".$flag."', NOW(), '".$ip."' ) "; $debug .= $q; mysql_query($q); $id = mysql_insert_id(); $debug .= "IDLAST:".$id; //get the size of the image in bytes //$_FILES['image']['tmp_name'] is the temporary filename of the file //in which the uploaded file was stored on the server $size=filesize($_FILES['upload']['tmp_name']); //compare the size with the maxim size we defined and print error if bigger if ($size > MAX_SIZE*1024) { echo '

You have exceeded the size limit!

'; $errors=1; } //we will give an unique name, for example the time in unix time format $image_name= "U".time().'.'.$extension; //the new name will be containing the full path where will be stored (images folder) $newname="uploads/upload".$id.".jpg"; // $image_name; //we verify if the image has been uploaded, and print error instead $copied = copy($_FILES['upload']['tmp_name'], $newname); $lat = 0; $lon = 0; if (!$copied) { echo '

Copy unsuccessfull!

'; $errors=1; } else { $debug .= $newname; if (exif_read_data($newname, 'IFD0') ) { $exif = exif_read_data($newname, 0, true); $output = "EXIF:"; foreach ($exif as $key => $section) { foreach ($section as $name => $val) { $output .= "KEY:".$key." NAME:".$name." VAL:".$val."---"; } if ($key == "GPS") { $lon = getGps($section["GPSLongitude"], $section['GPSLongitudeRef']); $lat = getGps($section["GPSLatitude"], $section['GPSLatitudeRef']); } else if ($key == "EXIF") { $original = $exif['EXIF']['DateTimeOriginal']; } } $debug .= $lat.$lon.$output; } // chroma function if (!$im = @ImageCreateFromJPEG ($newname) ) { if (!$im = @ImageCreateFromPNG ($newname) ) { if (!$im = @ImageCreateFromGIF ($newname) ) { echo "no valid image"; } } } $w = 500; $h = 500; $x = @getimagesize($newname); // image width $sw = $x[0]; // image height $sh = $x[1]; $hx = (100 / ($sw / $w)) * .01; $hx = @round ($sh * $hx); $wx = (100 / ($sh / $h)) * .01; $wx = @round ($sw * $wx); if ($hx < $h) { $h = (100 / ($sw / $w)) * .01; $h = @round ($sh * $h); } else { $w = (100 / ($sh / $h)) * .01; $w = @round ($sw * $w); } // $debug .= "sw:".$sw." sh:".$sh; // Create the resized image destination $src = @ImageCreateTrueColor ($w, $h); // Copy from image source, resize it, and paste to image destination @ImageCopyResampled ($src, $im, 0, 0, 0, 0, $w, $h, $sw, $sh); $out = ImageCreateTrueColor($w,$h) or die('Problem In Creating image'); // scan image pixels $t = 0; $c = 0; $xsize = imagesx($src); $ysize = imagesy($src); for ($x = 0; $x < $xsize;$x++) { for ($y = 0; $y < $ysize; $y++) { $t++; $src_pix = imagecolorat($src,$x,$y); $src_pix_array = rgb_to_array($src_pix); $chroma = false; // check for chromakey color if ($src_pix_array[0] > 180 && $src_pix_array[1] > 180 && $src_pix_array[2] > 180) { // if ($src_pix_array[0] > 180 && $src_pix_array[1] > 180 && $src_pix_array[2] > 180) { $chroma = true; } if ( ($src_pix_array[2] > (2*$src_pix_array[0]) ) || ($src_pix_array[2] > (2*$src_pix_array[1]) ) ) { // $chroma = true; } if ($src_pix_array[0] < 100 || $src_pix_array[1] < 100 || $src_pix_array[2] < 100) { $chroma = false; } /* afgeronde hoekjes $cx = $x-0.5*$xsize; // centered x $cy = $y-0.5*$ysize; if ( (sqrt($cx*$cx+$cy*$cy) ) > 240 ) { $chroma = true; } */ $chroma = false; if ($chroma) { $c++; $src_pix_array[0] = 255; $src_pix_array[1] = 255; $src_pix_array[2] = 255; } imagesetpixel($out, $x, $y, imagecolorallocate($out, $src_pix_array[0], $src_pix_array[1], $src_pix_array[2])); } } $p = floor($c/$t*100); if ($lat == 0 || $lon == 0) { $lat = $_POST['lat']; $lon = $_POST['lon']; } $q = "update momae set taken = '".$original."', lat = ".$lat.", lon = ".$lon.", exif = '".$output."', rate = ".$p." where id=".$id; // echo $q." x ".$x." y ".$y." c ".$c." t ".$t." p ".$p; mysql_query($q); // write $out to disc $filename = "uploads/upload".$id."-ok.jpg"; imageJpeg($out, $filename, 40) or die('Problem saving output image'); imagedestroy($out); $image = imagecreatefromJPEG($filename); //imagealphablending( $image, false ); //imagesavealpha( $image, true ); $background = ImageColorAllocate($image, 0,0,255); $foreground = ImageColorAllocate($image, 0,00,00); $trans = imagecolorallocate($image, 255,255,255); ImageColorTransparent($image, $trans); ImageInterlace($image, false); $filename = "uploads/upload".$id.".png"; imagePng($image, $filename); imageDestroy($image); } // einde ok lus } } } } function getGps($exifCoord, $hemi) { $degrees = count($exifCoord) > 0 ? gps2Num($exifCoord[0]) : 0; $minutes = count($exifCoord) > 1 ? gps2Num($exifCoord[1]) : 0; $seconds = count($exifCoord) > 2 ? gps2Num($exifCoord[2]) : 0; $flip = ($hemi == 'W' or $hemi == 'S') ? -1 : 1; return $flip * ($degrees + $minutes / 60 + $seconds / 3600); } function gps2Num($coordPart) { $parts = explode('/', $coordPart); if (count($parts) <= 0) return 0; if (count($parts) == 1) return $parts[0]; return floatval($parts[0]) / floatval($parts[1]); } // split rgb to components function rgb_to_array($rgb) { $a[0] = ($rgb >> 16) & 0xFF; $a[1] = ($rgb >> 8) & 0xFF; $a[2] = $rgb & 0xFF; return $a; } ?> MOMA Eindhoven




VISIT

  1) Go to Stadhuisplein, Eindhoven, NL

2) Download "Layar" app

3) Search & open layar "MoMA Eindhoven"



CONTRIBUTE



Upload your artwork to MoMA Eindhoven:

Thank you!
Title 
Artist
Description

File



* JPG, PNG or GIF



Total contributions:



Latest contributions: