Permalink
Browse files

Tadaa

  • Loading branch information...
0 parents commit 91cf45f988b21210f3d73d6e073ee90238eb3938 @lassse lassse committed Oct 3, 2012
Showing with 9,021 additions and 0 deletions.
  1. BIN .DS_Store
  2. BIN giftumblr/.DS_Store
  3. +163 −0 giftumblr/JPGMakerUploader.pde
  4. +37 −0 giftumblr/Timer.pde
  5. BIN giftumblr/data/Monaco-48.vlw
  6. BIN giftumblr/gifs/.DS_Store
  7. +332 −0 giftumblr/giftumblr.pde
  8. BIN giftumblr/temp/.DS_Store
  9. BIN libraries/.DS_Store
  10. +22 −0 libraries/fullscreen/COPYING
  11. +40 −0 libraries/fullscreen/examples/a_simple/a_simple.pde
  12. BIN libraries/fullscreen/examples/a_simple/data/test.png
  13. +42 −0 libraries/fullscreen/examples/b_softfullscreen/b_softfullscreen.pde
  14. +40 −0 libraries/fullscreen/examples/c_dualscreen/c_dualscreen.pde
  15. +14 −0 libraries/fullscreen/examples/d_list_resolutions/d_list_resolutions.pde
  16. BIN libraries/fullscreen/library/fullscreen.jar
  17. BIN libraries/fullscreen/library/libjAppleMenuBar.jnilib
  18. +58 −0 libraries/fullscreen/readme.txt
  19. +41 −0 libraries/fullscreen/reference/allclasses-frame.html
  20. +41 −0 libraries/fullscreen/reference/allclasses-noframe.html
  21. +144 −0 libraries/fullscreen/reference/constant-values.html
  22. +144 −0 libraries/fullscreen/reference/deprecated-list.html
  23. +531 −0 libraries/fullscreen/reference/fullscreen/FullScreen.html
  24. +276 −0 libraries/fullscreen/reference/fullscreen/FullScreenBase.DelayedAction.html
  25. +476 −0 libraries/fullscreen/reference/fullscreen/FullScreenBase.html
  26. +250 −0 libraries/fullscreen/reference/fullscreen/GLDrawableHelper.html
  27. +262 −0 libraries/fullscreen/reference/fullscreen/GLTextureUpdateHelper.html
  28. +444 −0 libraries/fullscreen/reference/fullscreen/SoftFullScreen.html
  29. +40 −0 libraries/fullscreen/reference/fullscreen/package-frame.html
  30. +212 −0 libraries/fullscreen/reference/fullscreen/package-summary.html
  31. +153 −0 libraries/fullscreen/reference/fullscreen/package-tree.html
  32. +217 −0 libraries/fullscreen/reference/help-doc.html
  33. +322 −0 libraries/fullscreen/reference/index-all.html
  34. +39 −0 libraries/fullscreen/reference/index.html
  35. +260 −0 libraries/fullscreen/reference/japplemenubar/JAppleMenuBar.html
  36. +32 −0 libraries/fullscreen/reference/japplemenubar/package-frame.html
  37. +155 −0 libraries/fullscreen/reference/japplemenubar/package-summary.html
  38. +151 −0 libraries/fullscreen/reference/japplemenubar/package-tree.html
  39. +44 −0 libraries/fullscreen/reference/overview-frame.html
  40. +158 −0 libraries/fullscreen/reference/overview-summary.html
  41. +152 −0 libraries/fullscreen/reference/overview-tree.html
  42. +2 −0 libraries/fullscreen/reference/package-list
  43. BIN libraries/fullscreen/reference/resources/inherit.gif
  44. +329 −0 libraries/fullscreen/reference/stylesheet.css
  45. +183 −0 libraries/gifAnimation/gifAnimation/docs/index.html
  46. BIN libraries/gifAnimation/gifAnimation/examples/gifDisplay/data/lavalamp.gif
  47. +55 −0 libraries/gifAnimation/gifAnimation/examples/gifDisplay/gifDisplay.pde
  48. BIN libraries/gifAnimation/gifAnimation/examples/gifExport/data/processing.png
  49. +40 −0 libraries/gifAnimation/gifAnimation/examples/gifExport/gifExport.pde
  50. BIN libraries/gifAnimation/gifAnimation/library/gifAnimation.jar
  51. +321 −0 libraries/gifAnimation/gifAnimation/src/Gif.java
  52. +803 −0 libraries/gifAnimation/gifAnimation/src/GifDecoder.java
  53. +1,292 −0 libraries/gifAnimation/gifAnimation/src/GifEncoder.java
  54. +174 −0 libraries/gifAnimation/gifAnimation/src/GifMaker.java
  55. +239 −0 php/GIFEncoder.class.php
  56. BIN php/gifs/.DS_Store
  57. +291 −0 php/upload.php
BIN .DS_Store
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,163 @@
+// Daniel Shiffman
+// <http://www.shiffman.net>
+// May 2006
+
+// Class to create a JPG file from a PImage
+// and post to a PHP script which uploads to server
+// HTTP Post code based heavily on examples from Vlad Patryshev (http://www.devx.com/Java/Article/17679/1954?pf=true)
+
+import java.awt.image.BufferedImage;
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import javax.imageio.*;
+import processing.core.*;
+
+public class JPGMakerUploader {
+
+ File file; // Reference to JPG File
+ String filename; // Local filename (not upload name)
+ BufferedImage bImg; // Need a BufferedImage to make fine
+ String uploadURL; // URL for php script
+ Random generator; // generate random number for "boundary"
+
+ URL url;
+ URLConnection connection;
+ OutputStream os;
+
+ // Constructor
+ JPGMakerUploader(PImage img, String f, String url) {
+ filename = f;
+ // Create BufferedImage from PImage
+ bImg = new BufferedImage(img.width, img.height, BufferedImage.TYPE_INT_RGB);
+ bImg.setRGB(0,0,img.width,img.height,img.pixels,0,img.width);
+ uploadURL = url;
+ generator = new Random();
+ }
+
+ // Save JPG file to sketch folder
+ public void saveJPG() {
+ //String filepath = sketchPath + "/" + filename + ".jpg";
+ String filepath = sketchPath + "/" + filename + ".jpg";
+ file = new File(filepath);
+ try {
+ //ImageIO.write(bImg, "jpg", file);
+ ImageIO.write(bImg, "jpg", file);
+ System.out.println("wrote file to: " + filepath);
+ }
+ catch (IOException e) {
+ System.out.println("Problem writing file.");
+ e.printStackTrace();
+ }
+ }
+
+
+ // Post to PHP upload script
+ // PHP Source available here: http://www.shiffman.net/ants/upload/upload.phps
+ public void upload() {
+ try {
+ System.out.println("posting to " + uploadURL);
+ String boundary = "---------------------------" + randomString() + randomString() + randomString();
+ url = new URL(uploadURL);
+ connection = url.openConnection();
+ connection.setDoOutput(true);
+ connection.setRequestProperty("Content-Type","multipart/form-data; boundary=" + boundary);
+ System.out.println("Opening connection. . .");
+ os = connection.getOutputStream();
+ writeParameter("form","true",boundary);
+ writeParameter("submit","submit",boundary);
+ writeFile("bytes",file,boundary);
+ boundary(boundary);
+ writeln("--");
+ System.out.println("Closing connection . . .");
+ os.close();
+ InputStream is = connection.getInputStream();
+
+ BufferedReader rd = new BufferedReader(new InputStreamReader(is));
+ String line;
+ while ((line = rd.readLine()) != null) {
+ System.out.println(line);
+ }
+ }
+ catch (MalformedURLException e) {
+ System.out.println("Bad url: " + uploadURL);
+ e.printStackTrace();
+ }
+ catch (IOException e) {
+ System.out.println("Problem posting to: " + uploadURL);
+ e.printStackTrace();
+ }
+ }
+
+ // Functions for writing to OutputStream (thanks again to Vlad Patryshev (http://www.devx.com/Java/Article/17679/1954?pf=true)
+ private String randomString() {
+ return Long.toString(generator.nextLong(), 36);
+ }
+
+ private void write(String s) throws IOException {
+ os.write(s.getBytes());
+ }
+
+ private void writeln(String s) throws IOException {
+ os.write(s.getBytes());
+ newline();
+ }
+
+ private void writeParameter(String name, String value, String b) throws IOException {
+ boundary(b);
+ newline();
+ write("Content-Disposition: form-data; name=\"");
+ write(name);
+ write("\"");
+ newline();
+ newline();
+ writeln(value);
+ }
+
+ private void pipe(InputStream in, OutputStream out) throws IOException {
+ byte[] buf = new byte[500000];
+ int nread;
+ int navailable;
+ int total = 0;
+ //synchronized (in) {
+ while((nread = in.read(buf, 0, buf.length)) >= 0) {
+ out.write(buf, 0, nread);
+ total += nread;
+ }
+ //}
+ out.flush();
+ in.close();
+ buf = null;
+ }
+
+ private void writeFile(String name, File file,String b) throws IOException {
+ boundary(b);
+ newline();
+ write("Content-Disposition: form-data; name=\"");
+ write(name);
+ write("\"");
+ write("; filename=\"");
+ write(file.getPath());
+ write("\"");
+ newline();
+ write("Content-Type: ");
+ String type = URLConnection.guessContentTypeFromName(file.getPath());
+ if (type == null) type = "application/octet-stream";
+ writeln(type);
+ InputStream is = new FileInputStream(file);
+ newline();
+ pipe(is, os);
+ newline();
+ }
+
+ private void newline() throws IOException {
+ write("\r\n");
+ }
+
+ private void boundary(String b) throws IOException {
+ write("--");
+ write(b);
+ }
+}
+
+
@@ -0,0 +1,37 @@
+// Learning Processing
+// Daniel Shiffman
+// http://www.learningprocessing.com
+
+// Example 10-5: Object-oriented timer
+
+class Timer {
+
+ int savedTime; // When Timer started
+ int totalTime; // How long Timer should last
+
+ Timer(int tempTotalTime) {
+ totalTime = tempTotalTime;
+ }
+
+ // Starting the timer
+ void start() {
+ // When the timer starts it stores the current time in milliseconds.
+ savedTime = millis();
+ }
+
+ void reset() {
+ savedTime = 0;
+ }
+
+ // The function isFinished() returns true if 5,000 ms have passed.
+ // The work of the timer is farmed out to this method.
+ boolean isFinished() {
+ // Check how much time has passed
+ int passedTime = millis()- savedTime;
+ if (passedTime > totalTime) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+}
Binary file not shown.
Binary file not shown.
Oops, something went wrong.

0 comments on commit 91cf45f

Please sign in to comment.