cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

2D and 3D image code

AlexK
14-Alexandrite

2D and 3D image code

Hello All,

 

I have been programming a step by step instruction, and noticed these issues when showing images:

 

This works fine with 2D images:

$scope.view.wdg["image-1"]['imgsrc'] = 'app/resources/Uploaded/1. Checkliste Werkzeug.png';

Note that the file name has spaces and dots.

 

This will not work for 3D images:

$scope.view.wdg["3DImage-1"]['src'] = 'app/resources/Uploaded/1. Checkliste Werkzeug.png';

But this works:

$scope.view.wdg["3DImage-1"]['src'] = 'app/resources/Uploaded/1_Checkliste_Werkzeug.png';

 

Why do the spaces and dots work in the 2D image file names but not for the 3D?

 

Also I've noticed that SVG files do not work for 3D images on my Apple Iphone and Ipad devices.

 

Best wishes,

 

Alex

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @AlexK ,

probably for the src property  the setter will not encode the url.

You can try to use the encodeURL javascript method

Example:

 

////
$scope.test=function(){
  
//sample file name =  '1 2 4 bla. bal .jpg'
//this url for the file name should be encoded
 $scope.setWidgetProp('image-1','imgsrc',     'app/resources/Uploaded/1 2 4 bla. bal .jpg'  );
//for for 2d without encoding
  $scope.setWidgetProp('3DImage-1','src',  encodeURI('app/resources/Uploaded/1 2 4 bla. bal .jpg') );
  $scope.$applyAsync()
}

for the 3DImage widget you need to convert the url using encodeURL .

For the 2d Image widget  you do not need to encode the url but anyway it will work both:

$scope.setWidgetProp('image-1','imgsrc',     'app/resources/Uploaded/1 2 4 bla. bal .jpg'  );
//and
  $scope.setWidgetProp('image-1','imgsrc',     encodeURI('app/resources/Uploaded/1 2 4 bla. bal .jpg') );

 

View solution in original post

2 REPLIES 2

Hi @AlexK ,

probably for the src property  the setter will not encode the url.

You can try to use the encodeURL javascript method

Example:

 

////
$scope.test=function(){
  
//sample file name =  '1 2 4 bla. bal .jpg'
//this url for the file name should be encoded
 $scope.setWidgetProp('image-1','imgsrc',     'app/resources/Uploaded/1 2 4 bla. bal .jpg'  );
//for for 2d without encoding
  $scope.setWidgetProp('3DImage-1','src',  encodeURI('app/resources/Uploaded/1 2 4 bla. bal .jpg') );
  $scope.$applyAsync()
}

for the 3DImage widget you need to convert the url using encodeURL .

For the 2d Image widget  you do not need to encode the url but anyway it will work both:

$scope.setWidgetProp('image-1','imgsrc',     'app/resources/Uploaded/1 2 4 bla. bal .jpg'  );
//and
  $scope.setWidgetProp('image-1','imgsrc',     encodeURI('app/resources/Uploaded/1 2 4 bla. bal .jpg') );

 

AlexK
14-Alexandrite
(To:RolandRaytchev)

Thanks! It worked!

Top Tags