images.add('icon', bufferFile) not working but working for logo
gavinwolfe opened this issue · 1 comments
So I have spend more than a day trying to solve this trying every possible hint of a solution from other issues forums here, but no luck. I have a data64 string passed from my front end iOS app to cloud function. Then I convert it to buffer file and pass through pass.images.add() for both icon and logo, but icon never appears on the pass, always hidden. There is in fact an image stored as the buffer, I have made sure of this many times. I have even tried to use the same buffer that displays and image for logo but it does not work for icon.
The only way Icon displays in image is when I call:
await template.images.load('./models/images');
My saved files of path ./models/images contains thumbnail.png of size 112*132 or better known too as apples default thumbnail photo for passes
But when I call:
const buf = Buffer.from(eventImage1, 'base64');
const buf2 = Buffer.from(eventImage2, 'base64');
await pass.images.add('icon', buf2);
await pass.images.add('logo', buf);
The pass builds but there is no image for icon
https://imgur.com/gallery/AqFgIAm
I even have tried to use the same url for icon and logo. But then what happens is logo has an image but icon does not!
I have also tried downloading the image from a url and converting it to a buffer, the same result occurs.
Unless I call await template.images.load('./models/images');
the icon never loads an icon. I tried calling await pass.images.add('icon', buf2);
after await template.images.load('./models/images');
but the same result occurs. I cannot use await template.images.load('./models/images');
because icon image for my case must be dynamic. I have tried even using
await pass.images.add('icon', './models/images/thumbnail.png');
just to test it out and that doesn't even work, it fails with output pass must include icon.png
Btw the buffer file is a legitimate png image. It prints in console, is the correct size for the icon, and I have tried both 112x142 and 224x283, none work.
So why can't I see the buffer image at icon? It must have an image there to create the pass, but how come It does not become visible?
What am I doing wrong? Any help at the point would make my day! thank you (:
To anyone that runs into this same issue, don't make the silly mistake I did. I was wanting to set thumbnail image, not logo. logo is not the image that was displaying as invisible, thumbnail was bc I wasn't setting it.