CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

Picture file Load and Export

by zsleo » 06 Oct 2016 10:04

Are there methods to Load and Export this component from picture files - PNG and or JPG will be ideal.

I have per the demo v3 example ExportImage to a JQImage and then save from the JQImage. Export to JQImage works fine for me but the save to file form JQImage never results in a saved file.

Any help will be appreciated.

Attached is a small (messy) example project.

TIA

IW_CDG_No_DB.7z
You do not have the required permissions to view the files attached to this post.
zsleo
 
Posts: 776
Joined: 03 Feb 2013 03:33

by zsleo » 10 Oct 2016 01:46

I really need to get this to work.

All help appreciated

TIA
zsleo
 
Posts: 776
Joined: 03 Feb 2013 03:33

by Alexander Bulei » 10 Oct 2016 17:05

Hi zsleo,

I have checked your demo, and it work as expected.

Some tips to check:
* Directory exists?
* Have permissions to write in folder?

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by zsleo » 10 Oct 2016 23:01

Directory exists and permission are correct.

I changed the directory to WebApplication.UserCacheDir and it still does not save the file. The following error is generated

IWBase__ECF8FECF6.js:2 Error in processAjaxExecute when evaluating:
var img = new Image(); var $cgimg = $("#JQWPAINTIMG_IMG"); var src = $cgimg.attr("src"); var canvas = document.createElement("canvas"); var context = canvas.getContext("2d"); img.width = $cgimg.width(); img.height = $cgimg.height(); img.crossOrigin = "anonymous"; img.onload = function() { canvas.width = img.width; canvas.height = img.height; context.drawImage(img, 0, 0, img.width, img.height); var imgDataUrl = canvas.toDataURL("image/png"); imgDataUrl = imgDataUrl.replace(/^data:image\/(png|jpg);base64,/, ""); CGSendLargeDataToUrl([{"value":imgDataUrl,"name":"imageData"},{"value":"C:\\Users\\ZANELE~1.ADE\\AppData\\Local\\Temp\\01b10q8m08\\user\\Z~elvCByfegw2jrTMkm3qq\\567.png","name":"filename"}],"/IWCGJQ/IDD232C8F8C8C1428DA820B58F41630893ActionGetImageDataUrl"); } img.src = src;
Unexpected identifier


I do not know JScript well enough but a JScript verifier on google suggests that right at the end of the script "; } img.src = src;" should be "; }; img.src = src;"

Regards
zsleo
 
Posts: 776
Joined: 03 Feb 2013 03:33

by Alexander Bulei » 11 Oct 2016 11:34

Hi zsleo,

Yeah, you are right!
Its happens when Debug = False

Fixed. Thank you.

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by zsleo » 11 Oct 2016 13:25

Thanks Alexander,

Does this mean I have to wit for next release?

.. and are you saying that switching debug on will fix it in the short term


TIA
zsleo
 
Posts: 776
Joined: 03 Feb 2013 03:33

by Alexander Bulei » 11 Oct 2016 14:04

Hi,

Does this mean I have to wit for next release?


Yes

.. and are you saying that switching debug on will fix it in the short term


Yes


Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by zsleo » 12 Oct 2016 11:31

Okay... more issues for me.

1.
IWCGJQWPaint.JQWPaintOptions.Image := 'files/page.png' ==>> {D:\inetpub\MSQL\wwwroot\Files\page.png}

is inconsistant wih

JQwPaintImg.SaveImage('files/page.png') ==>> {D:\inetpub\MSQL\Files\page.png}

I have a db that manages PNG image files. Creating new images and saving them using these two components via a saved file is work as expected.

My problem is redisplaying the file into IWCGJQWPaint is just not happening for me. Here are my finding.

2.
IWCGJQWPaint.JQWPaintOptions.Image := 'D:\inetpub\MSQL\wwwroot\Files\page.png'
Not allowed to load local resource: file:///D:/inetpub/MSQL/wwwroot/Files/page.png

3.
IWCGJQWPaint.JQWPaintOptions.Image := 'files/page.png'
No errors but does not display the image

4.
IWCGJQWPaint.JQWPaintOptions.Image := 'wwwroot/files/page.png' -> http://127.0.0.1:4081/$/wwwroot/files/page.png
Failed to load resource: the server responded with a status of 404 (Not Found) <<== but it does exist in both D:\inetpub\MSQL\wwwroot\Files\page.png and D:\inetpub\MSQL\Files\page.png


More help needed.

Regards
zsleo
 
Posts: 776
Joined: 03 Feb 2013 03:33

by Alexander Bulei » 12 Oct 2016 16:34

Hi,

In ISAPI or SA?

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by zsleo » 12 Oct 2016 20:18

Definitely in SA. Have not yet tested ISAPI.
zsleo
 
Posts: 776
Joined: 03 Feb 2013 03:33

Next

Return to JQWPaint

cron

Who is online

Users browsing this forum: No registered users and 1 guest

Contact Us.