Rank: Advanced Member
Groups: Member
Joined: 3/20/2018(UTC) Posts: 61
Thanks: 4 times
|
HI everybody. I hope you all well, I need your help again I need to Add Itemimage placeholder to my product. I did it well with this code // async function addimage_asyncCall () { editor.getProduct(); // When we get the product. let product = await editor.getProduct(); var Model = CustomersCanvas.DesignAtoms.ObjectModel; var currentSurface = product.currentSurface; var placeholder = new Model.PlaceholderItem(new Model.RectangleF(0, 0, currentSurface.width, currentSurface.height)); currentSurface.insertItem(placeholder); } // But Now I need to add automatically an image from my website. For exemple when click on my button "all LOGO" I want to ad logo from https://www.rapidecard.c...rd/images/logorapide.pngCan I have the best way to do that. Thanks for the help.
|
|
|
|
Rank: Member
Groups: Joined: 11/14/2019(UTC) Posts: 29
Was thanked: 1 time(s) in 1 post(s)
|
Hello Ben,
Do you want to insert a placeholder with an already inserted picture or just insert a picture?
Regards, Victor
|
|
|
|
Rank: Advanced Member
Groups: Member
Joined: 3/20/2018(UTC) Posts: 61
Thanks: 4 times
|
insert a placeholder with an already inserted picture.
|
|
|
|
Rank: Member
Groups: Joined: 11/14/2019(UTC) Posts: 29
Was thanked: 1 time(s) in 1 post(s)
|
You can insert a picture using the loadUserInfo method
editor.loadUserInfo({"layerName": "imageUrl"});
Documentation link:https://customerscanvas.com/docs/cc/working-with-user-data.htm
Let me know if this help you
Regards, Victor
|
|
|
|
Rank: Advanced Member
Groups: Member
Joined: 3/20/2018(UTC) Posts: 61
Thanks: 4 times
|
Thanks Victor it's not possible to Add image using design atom framework?
What I need to do is insert a placeholder with an already inserted picture with "imageUrl. or if you want or just insert a picture using design atom framework.
|
|
|
|
Rank: Advanced Member
Groups: Member
Joined: 3/20/2018(UTC) Posts: 61
Thanks: 4 times
|
I tried this But the picture don't appear async function addimage_asyncCall () { editor.getProduct(); // When we get the product. let product = await editor.getProduct(); var Model = CustomersCanvas.DesignAtoms.ObjectModel; var currentSurface = product.currentSurface; // Add an image placeholder with a rectangular frame. //var photoFile = new FileInfo(@"images\c.bennett.jpg")); var photoFile = "https://upload.wikimedia.org/wikipedia/commons/thumb/6/66/Baby_%28Unsplash%29.jpg/1599px-Baby_%28Unsplash%29.jpg"; var photoImage = new Model.ImageItem(photoFile, new Model.PointF(201, 146), 456, 834); var photoPlaceholder = new Model.PlaceholderItem() { SourcePath = new Model.PlaceholderItem(new Model.RectangleF(98, 170, 147, 184)), ManipulationPermissions = new Model.ManipulationPermissions(true), Content = photoImage, Name = "photo" };
|
|
|
|
Rank: Member
Groups: Joined: 11/14/2019(UTC) Posts: 29
Was thanked: 1 time(s) in 1 post(s)
|
The code I proposed works with the Design Atoms object model, see the code for the picture (it will work for the placeholder as well):
let product = await editor.getProduct(); let productModel = await product.getProductModel(); let Model = CustomersCanvas.DesignAtoms.ObjectModel; let currentSurface = product.currentSurface; let image_item = new Model.ImageItem(null, new Model.PointF(0,0), width, height); image_item.name = "layerName"; //add layer name currentSurface.insertItem(image_item); data.layerName = url; //pass url to layer name await editor.loadUserInfo(data); //load user info
Let me know if this help you
Regards, Victor
|
|
|
|
Rank: Advanced Member
Groups: Member
Joined: 3/20/2018(UTC) Posts: 61
Thanks: 4 times
|
Good, that's work fine thanks Victor
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.