[PLUGIN] c2i - canvas/base64/screenshot to image

Post your completed addons to share with the community

Post » Tue Mar 27, 2012 8:53 pm

Hi,
this plugin saves the whole c2-canvas, a base64-string or a sprite via ajax(= a short php-script) to an image in png-format on a webserver.

Because the images get saved on a webserver with php the plugin doesn't work in preview mode.
- - - - - -
History:
1.1) Since version 1.1 it's possible to create PNG-files out of Base64-strings. Together with Pode's behavior "Extract Sprite to base64 string" it's possible to save sprites to images.
1.2) Since version 1.2 customizable screenshots are possible.
1.3) code cleaning
1.4) supports WebGL
1.5) works on Android via fallback-script
- - - - - -

- - - - Android bugfix release - - - -
[Update5] c2i - v 1.5:
[Add]Fallback for Android-Devices (ie 2.1,2.2,2.3,..?)
The Plugin uses a fallback script when 'toDataURL()' has no native support from the browser - c2i2dataURL.js.
On Android-devices only Opera works as expected and understands toDataURL() (-no fallbackscript used). The webkit-browsers on Android need the fallback-script..
HowTo convince Android: Copy the file c2i2dataURL.js next to index.html

Demo - canvas/sprite/screenshot + Plugin(v 1.5)-- demoproject (capx,exported project) + php-script + fallback bugfix-script

____________
[Update4] c2i - v 1.4:
Plugin is completely rewritten.

[Changed] WebGL-support - It should work now with both renderers - currently on desktop browsers (+ on Android - only with Opera).
[Changed] Plugin is now a "world-plugin". If you don't want to see a "black canvas" in C2, give it an image-texture - transparent image should be possible.

Demo - canvas/sprite/screenshot + Plugin(v 1.4)+capx
changed php-file (filename)
__________________________________________
Property:


Actions:


Condition:


short overview how2use:


Have fun and all suggestions are welcome ,
Joe7Joe72012-04-10 23:16:05
B
14
S
6
G
5
Posts: 173
Reputation: 4,742

Post » Tue Mar 27, 2012 9:00 pm

Wow! This is amazing!

Do you think you can add a way to crop the image (or the export area) between two coordinates so we can choose what part of the screen will be cropped?

I'm gonna download it tonight and see how it works! :D
B
107
S
40
G
10
Posts: 456
Reputation: 13,202

Post » Tue Mar 27, 2012 9:02 pm

Really nice plugin, Joe7 !
There's something I don't understand, though : what's the use of the php/Ajax part ?
B
33
S
9
G
6
Posts: 709
Reputation: 6,704

Post » Tue Mar 27, 2012 9:28 pm

@Pode: The Ajax part is the saving - php creates from a base64 string an imagefile. Now I've seen your last behavior and I'll try to add another action to the plugin to save standalone sprites - should be possible now.

On the webserver are the following files:
Joe72012-03-28 01:21:14
B
14
S
6
G
5
Posts: 173
Reputation: 4,742

Post » Tue Mar 27, 2012 10:06 pm

@Joe7: okaaay ! I didn't understood . For the plugin part (I suppose you are thinking about "Save File"), I need to add the "save binary" method to help you.
B
33
S
9
G
6
Posts: 709
Reputation: 6,704

Post » Tue Mar 27, 2012 10:48 pm

@Pode: Now this plugin is usable with your Base64-behavior.
@gammabeam: done Joe72012-03-28 01:11:07
B
14
S
6
G
5
Posts: 173
Reputation: 4,742

Post » Wed Mar 28, 2012 7:53 am

@Joe7 : great !
B
33
S
9
G
6
Posts: 709
Reputation: 6,704

Post » Tue Apr 03, 2012 1:23 pm

AMAZING plugin!!!
B
41
S
11
G
4
Posts: 428
Reputation: 7,356

Post » Tue Apr 03, 2012 1:46 pm

Joe7 is the option suggested by GammaBeam (crop the image or the export area between two coordinates) implemented already?
B
41
S
11
G
4
Posts: 428
Reputation: 7,356

Post » Tue Apr 03, 2012 2:10 pm

If Ive understood this correctly, then yes.
The Action "Screenshot saving request" takes 4 number-parameters:
from (leftTopCornerX,leftTopCornerY) to (rightBottomCornerX, rightBottomCornerY)
--> a rectangle from leftTop to rightBottom gets saved

In the demo the rect is adaptable - drag "1"(=leftTop) and drag "2"(=rightBottom) --> "save rect" to create the PNG-image on the server and then "show"

Joe72012-04-03 14:15:26
B
14
S
6
G
5
Posts: 173
Reputation: 4,742

Next

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 3 guests