Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image properties option applies to all other images too. #154

Open
faizaankhan opened this issue Feb 11, 2020 · 3 comments
Open

Image properties option applies to all other images too. #154

faizaankhan opened this issue Feb 11, 2020 · 3 comments
Labels

Comments

@faizaankhan
Copy link

faizaankhan commented Feb 11, 2020

I'm working with a report, where I have some logo for which I am dynamically assigning width and height in properties, considering aspect ratio and other calc.

I also have some other images in the report, suppose a list of students with an avatar.

The issue I'm facing is that, when properties are passed to the Logo, the same properties forcefully reflect on the student avatar images too.

I tried passing a blank object to properties, such that default way of placing the images based on the placeholder works for the student avatars.

Problem is: Image for avatars are not taking the placeholder size when properties are not passed to them, they take properties from last element.

image

@faizaankhan
Copy link
Author

faizaankhan commented Feb 11, 2020

PS:
This happens with the avatar images even if I do

Sablon.content(:image, path)
Sablon.content(:image, path, properties)
Sablon.content(:image, path, properties: {})
Sablon.content(:image, path, properties: {width: nil, height: nil})

but it works fine when a width or height is explicitly gievn like
Sablon.content(:image, path, properties: { width: "2cm", height: "2cm" })

And my Logo image is doing
Sablon.content(:image, path, properties: { width: "3cm", height: "5cm" })

After some digging in, I found out that, in the code here
https://github.com/senny/sablon/blob/master/lib/sablon/processor/document/blocks.rb#L100
image

nodes are not just referring to the specific place(the outer image), but other nodes also, and it's updating other values(in my case the avatar placeholders).

@nikhilgoyal22
Copy link

@stadelmanma is there any progress on this? It this repo being worked upon?

@stadelmanma
Copy link
Collaborator

@nikhilgoyal22 I haven't worked on this issue for awhile, the general problem here is that the xpath selector is not specific enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants