400) { $ratio_w = 400/$width; } else { $ratio_w = 1; } // check if height is 600 or less if ($height > 300) { $ratio_h = 300/$height; } else { $ratio_h = 1; } // determine which ratio creates the smaller image if ($ratio_w <= $ratio_h) { $aspect_ratio = $ratio_w; } else { $aspect_ratio = $ratio_h; } // new resizing code $new_w = abs($width * $aspect_ratio); $new_h = abs($height * $aspect_ratio); $size = $new_h; $aspect_ratio = $height/$width; //start resizing if ($height <= $size) { $new_w = $width; $new_h = $height; } else { $new_h = $size; $new_w = abs($new_h / $aspect_ratio); } $img = imagecreatetruecolor ($new_w,$new_h); //save image imagecopyresampled ($img,$src,0,0,0,0,$new_w,$new_h,$width,$height); imagejpeg($img, $rel_path_to_img, $quality); imagedestroy($img); } //////////////////////////////////// // end of resize images function /////////////////////////////////// //////////////////// // End functions //////////////////// ///////////////////////////////////////////////// // // Submit an image to grafedia // // check to see if it is in fact an image, then upload it to images/grafedias/ // make a version that is small enough for phones // finally, add the info to the DB. // ///////////////////////////////////////////////// $file = $_FILES['userfile']['tmp_name']; $file_size = $_FILES['userfile']['size']; $orig_file = $_FILES['userfile']['name']; $image_size = getimagesize($file); $uploaddir = $_SERVER['DOCUMENT_ROOT'].'/images/grafedias/'; // the directory for this node's photoblog //$thumbdir = $_SERVER['DOCUMENT_ROOT'].'/images/grafedias/'; if(getimagesize($file) && is_uploaded_file($file)) { // if it is an image, and less than 10 MB, upload it $exit = 0; // first check to see that a word has been provided with the image: $image_id = $HTTP_POST_VARS['word']; if(!$image_id) { $error_text .= "-please choose a word to associate with this grafedia image.

"; $exit = 1; } // check to see if this word is already associated with an image if(!$exit){ $db_conn = dbconnect() or die (dbconnerror()); $query_check_word = "SELECT COUNT(*) FROM IMAGES WHERE IMG_ID = '$image_id'"; $db_result_check_word = mysql_query($query_check_word) or die (dbqueryerror($query_check_word)); $word_exists = mysql_result($db_result_check_word,0,0); // if it is in use, give an error message if($word_exists > 0) { $error_text .= "-this word is already in use as grafedia. please try a variation (such as \"".$image_id."-1\"), or pick a synonym."; $exit = 1; } } if(!$exit) { // if the word isn't in use, and all the data is there, upload the image and insert into DB: // the full and relative pathways to the image on the server: $full_path = $uploaddir."masters/".$image_id.'.jpg'; $full_thumb_path = $uploaddir.$image_id.'.jpg'; $relative_path = "images/grafedias/masters/".$image_id.".jpg"; $relative_thumb_path = "images/grafedias/".$image_id.".jpg"; move_uploaded_file($file,$full_path); // once on the server, if the image is too big, resize it if($image_size[0] > 400 || $image_size[1] > 300) { $quality = 80; resize_big_images($full_path,$relative_thumb_path, $quality); $image_weight = filesize($relative_thumb_path); } else { // if image is not too big, just duplicate it to the thumbs directory: copy($full_path,$full_thumb_path); $image_weight = filesize($relative_thumb_path); } // make sure the file isn't too heavy for cell carriers: while($image_weight > 25000) { $quality = $quality - 5; resize_big_images($full_path,$relative_thumb_path,$quality); // resize_big_images($full_path,$relative_thumb_path,$quality); $image_weight = filesize($relative_thumb_path); if($quality < 20) { break; } } // insert just the IMAGE info into DB (user is not logged in - is doing ANONYMOUS upload if(!$logged_in) { $insert_img_info = "INSERT DELAYED INTO IMAGES (IMG_ID) VALUES ('$image_id')"; if (!mysql_query($insert_img_info)) { echo("something is amiss."); } else { } } // author IS logged in - insert author info, to mark this image/word as his. else{ $insert_img_info = "INSERT DELAYED INTO IMAGES (IMG_ID, AUTHOR_ID) VALUES ('$image_id','$author_id')"; if (!mysql_query($insert_img_info)) { echo("something is amiss."); } else { } } $preview_image = 1; } // DON'T REMOVE THIS: // if the connection is open, close it. if($db_conn) { mysql_close($db_conn); } } ////////////////////////////////////// // End of submit image ////////////////////////////////////// ?>

       
Making grafedia involves three basic steps:
  1. Create an image on your computer, and choose a word you want to associate with it. (example: a photo of a cat, with the associated word "kitty") 
  2. Upload both the image and the associated word together to the grafedia server at http://www.grafedia.net. By doing this, you create an address for that image in the format 'yourword@grafedia.net'. 
  3. Write or draw this address tag wherever you want people to see your grafedia, using chalk, pen, pencil, etc. The address tag can be written alone, or written as part of a longer text, or it can be incorporated into an artwork.
There's no need to create an account or log in to upload work to grafedia.net. You can just upload an image and link it to a word anonymously, then go out and make grafedia with it.

You can however opt to create an account on grafedia.net. This will allow you to manage your image/word combinations, reviewing them, deleting them, and swapping out newer images for old ones.

-------
*You can also make grafedia on the fly, on the street without visiting grafedia.net beforehand - simply take a picture with your camera phone, make up an associated word, and send the image to 'yourword@grafedia.net', then tag that address on a surface. Others will be able to retrieve the image with their cells by sending a message to that address.

       

Upload Images Anonymously

Upload an image and a word to make grafedia:

Image:

Associated word:     

your grafedia image:


\"".$image_id."\"") ?>

Done! Your image has been uploaded to grafedia.net.

To make grafedia with it, point viewers to @grafedia.net



Upload Images to an Account

Create an account

-or-

Log in:
Alias
Password