Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
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
Solved! Go to Solution.
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') );
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') );
Thanks! It worked!