Post To Web Library Question
in
Contributed Library Questions
•
2 years ago
Hello Everyone,
I want to create a PGraphics off-screen then upload it to my server. I am using the
Post To Web library. The .php file is on the server and successfully receives an image of the current sketch when I use the code on line 19 (verified via ftp), but does not upload my PGraphics type when I use the code on line 17. I really do not know what the 'g' in img.getBytes(g) is - any ideas?
In the console I receive the following message:
java.lang.IllegalArgumentException: im == null!
at javax.imageio.ImageIO.write(ImageIO.java:1457)
at javax.imageio.ImageIO.write(ImageIO.java:1565)
at org.seltar.Bytes2Web.ImageToWeb.getBytes(ImageToWeb.java:142)
at webApp.orderButton(webApp.java:790)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at controlP5.ControlBroadcaster.invokeMethod(Unknown Source)
at controlP5.ControlBroadcaster.callTarget(Unknown Source)
at controlP5.ControlBroadcaster.broadcast(Unknown Source)
at controlP5.Controller.broadcast(Unknown Source)
at controlP5.Button.setValue(Unknown Source)
at controlP5.Button.mouseReleased(Unknown Source)
at controlP5.Controller.setMousePressed(Unknown Source)
at controlP5.ControllerGroup.setMousePressed(Unknown Source)
at controlP5.ControllerGroup.setMousePressed(Unknown Source)
at controlP5.ControlWindow.mouseEvent(Unknown Source)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at processing.core.PApplet$RegisteredMethods.handle(Unknown Source)
at processing.core.PApplet.handleMouseEvent(Unknown Source)
at processing.core.PApplet.dequeueMouseEvents(Unknown Source)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:619)
<p><b>Error:</b> File is empty!</p>
- String url = "http://myDomain.com/Upload.php";
- PGraphics pg = createGraphics(myX,myY,P2D);
- pg.beginDraw();
- pg.image(testImage,0,0,pg.width,pg.height);
- pg.endDraw();
- img.setType(ImageToWeb.PNG);
- String subFolder = "subFolder";
- String fileName = "fileName";
- img.post(subFolder,url,fileName,false,img.getBytes(pg)); // this is the problem line
- // img.post(subFolder,url,fileName,false,img.getBytes(g));
Any help is appreciated. Thanks everyone.
-aimless
1