Meet us at Drupa 24. Dusseldorf/Germany. May. 28 - Jun 7.
Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
benadams  
#1 Posted : Friday, April 17, 2020 4:12:25 AM(UTC)
benadams

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.png


Can I have the best way to do that.

Thanks for the help.
VictorTolstov  
#2 Posted : Friday, April 17, 2020 6:29:21 AM(UTC)
VictorTolstov

Rank: Member

Groups: Member
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
benadams  
#3 Posted : Friday, April 17, 2020 7:53:20 AM(UTC)
benadams

Rank: Advanced Member

Groups: Member
Joined: 3/20/2018(UTC)
Posts: 61

Thanks: 4 times
insert a placeholder with an already inserted picture.
VictorTolstov  
#4 Posted : Friday, April 17, 2020 9:20:51 AM(UTC)
VictorTolstov

Rank: Member

Groups: Member
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
benadams  
#5 Posted : Friday, April 17, 2020 9:38:08 AM(UTC)
benadams

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.



benadams  
#6 Posted : Friday, April 17, 2020 9:45:04 AM(UTC)
benadams

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"
};
VictorTolstov  
#7 Posted : Friday, April 17, 2020 12:00:19 PM(UTC)
VictorTolstov

Rank: Member

Groups: Member
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
benadams  
#8 Posted : Monday, April 20, 2020 4:37:16 AM(UTC)
benadams

Rank: Advanced Member

Groups: Member
Joined: 3/20/2018(UTC)
Posts: 61

Thanks: 4 times
Good,
that's work fine
thanks Victor
Users browsing this topic
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.