Skip to content

Conversation

@vtran99
Copy link
Contributor

@vtran99 vtran99 commented Jan 31, 2024

Request to add the picture to personal data type of registration.
This will help to display picture for registrations in Participant List or Badges.

@tomasr8
Copy link
Member

tomasr8 commented Jan 31, 2024

Does this need a new RegistrationPDPlaceholder?

@vtran99
Copy link
Contributor Author

vtran99 commented Jan 31, 2024

Does this need a new RegistrationPDPlaceholder?

Well, to be complete, it's not only a placeholder in designer, but should also be in:

  • registration list
  • participant list
  • ...
    and the picture could be rendered as url, binary, whatever form... so I suggest to wait and add that part following the feature needed.

@ThiefMaster
Copy link
Member

I think adding a placeholder to include it on badge would make sense in this PR. I guess that's something you guys need anyway?

@vtran99
Copy link
Contributor Author

vtran99 commented Feb 1, 2024

I think adding a placeholder to include it on badge would make sense in this PR. I guess that's something you guys need anyway?

Done.

@tomasr8
Copy link
Member

tomasr8 commented Feb 1, 2024

I think adding a placeholder to include it on badge would make sense in this PR. I guess that's something you guys need anyway?

Done.

There are still some lint/test issues, could you fix them?

@vtran99
Copy link
Contributor Author

vtran99 commented Feb 1, 2024

I think adding a placeholder to include it on badge would make sense in this PR. I guess that's something you guys need anyway?

Done.

There are still some lint/test issues, could you fix them?

Done.

@vtran99
Copy link
Contributor Author

vtran99 commented Feb 5, 2024

I removed the picture from get_personal_data and added a stand-alone get_personal_data_picture, which will be used anytime the picture needs to be retrieved (to avoid having to build the whole personal data dict).

@vtran99 vtran99 requested a review from ThiefMaster February 5, 2024 13:42
@ThiefMaster ThiefMaster force-pushed the Add_picture_to_personal_data branch 2 times, most recently from cc9d2b2 to 10b8a43 Compare February 9, 2024 16:50
Copy link
Member

@ThiefMaster ThiefMaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed a bunch of bugs, I think this is fine now. But have a quick look over my fixes.

@ThiefMaster
Copy link
Member

One thing that might be worth fixing here is the fact that the aspect ratio is not honored when the picture is rendered on a badge. Cropping may lose some important data, so maybe it should be resized so it fits in the size of the badge placeholder (and then just has some more blank space around it when the aspect ratios don't match)

@vtran99
Copy link
Contributor Author

vtran99 commented Feb 12, 2024

I tested with all your changes, it's fine, nothing broken.
For the picture ratio on the badge, let's keep it like that for the moment, same as we had on v1 and v2, can be improved later on.

@ThiefMaster
Copy link
Member

Squeezing the image in such a way feels like a bug to me that should be fixed before merging it upstream...

@vtran99
Copy link
Contributor Author

vtran99 commented Feb 12, 2024

Ok for you if I use the default 'preserveAspectRatio' of the library ?
It will center the picture in the frame, the blank space could be around width/height depending of the picture format...

@ThiefMaster
Copy link
Member

Not sure if that would work since you can still upload any aspect ratio (seems reasonable, the user may upload a landscape picture but then crop it to only have the relevant part with their picture which is not landscape anymore), and the badge template is completely unrelated to that.

Maybe the regform picture field needs a setting to enforce a certain aspect ratio in case this is needed (actually I'm surprised you do not have this requirement at the UN - the last time I got a UN badge my photo was actually squished which did not look very flattering; some people might even be annoyed/offended by that ;))

@vtran99
Copy link
Contributor Author

vtran99 commented Feb 12, 2024

I did a test with the case you mentioned: upload a landscape pict, crop to get just the face part, the rendering is correct with preserveAspectRatio, as the picture saved is the new one created from the crop, with the format of the crop and not the landscape format anymore.
To resume, the picture rendered in the draw_image with preserveAspectRatio will match the ratio of picture saved (cropped or not) of the upload.

@ThiefMaster
Copy link
Member

But how will that help when it gets squeezed in the size of the placeholder in the badge template? If that placeholder is square and the image is e.g. in 2:3 format, it will still get squished, won't it?

@vtran99
Copy link
Contributor Author

vtran99 commented Feb 12, 2024

It will be rendered in 2:3 format, with blank to fill the placeholder.
And that's correct, if user uploads a picture with 2:3 format, will see a 2:3 format !

@vtran99
Copy link
Contributor Author

vtran99 commented Feb 12, 2024

badge-flag

@vtran99
Copy link
Contributor Author

vtran99 commented Feb 12, 2024

The placeholder is a square, and the picture uploaded in 2:3, the rendering is 2:3.

@vtran99
Copy link
Contributor Author

vtran99 commented Feb 12, 2024

picture vertical when uploaded, badge rendered with same square placeholder:
Screenshot 2024-02-12 at 16 02 38

@ThiefMaster
Copy link
Member

looks good :)

@vtran99
Copy link
Contributor Author

vtran99 commented Feb 12, 2024

How about my suggestion to change the _reglist.html ?
just modify the td condition instead of adding a search_value
<td class="i-table">{{ data[item.id].friendly_data if item.id in data and data[item.id].friendly_data else '' }}</td>

@ThiefMaster
Copy link
Member

I don't see where you made that... (or is it new?).

Anyway, this is generic and not specific to the picture field, so I'd prefer to use the same logic we use in other places in the template.

@vtran99
Copy link
Contributor Author

vtran99 commented Feb 13, 2024

All done on my side related to your review.

@ThiefMaster
Copy link
Member

Oh now I understand after seeing your commit. I did not expect camelCase in the Python code so I assumed this is a prop you pass somewhere on the image cropping UI of the regform!

@ThiefMaster ThiefMaster force-pushed the Add_picture_to_personal_data branch from f2f4603 to 0f4bd2c Compare February 14, 2024 00:00
@ThiefMaster ThiefMaster enabled auto-merge (squash) February 14, 2024 00:02
@ThiefMaster ThiefMaster added this to the v3.3 milestone Feb 14, 2024
@ThiefMaster ThiefMaster merged commit 13bf0ac into indico:master Feb 14, 2024
@ThiefMaster ThiefMaster deleted the Add_picture_to_personal_data branch February 14, 2024 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants