Support

Support is part of Event Gallery Extended.

Please get a subscription if you need support. Feel free to use the ticket system or the contact form for reporting defects or pre-sale questions. Make sure you're logged in in order to be able to create a new ticket.

For general information you can also jump to the manual.

Subscribe now!

#2976 Smarty e-mail template doesnt return the correct image url

Posted in ‘Event Gallery Extended’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Latest post by EnduranceCode on Sunday, 24 December 2017 13:25 UTC

EnduranceCode
 Hi Sven,

The code
<img src="https://www.svenbluege.de/{$lineitem->thumburl}">
in the smarty e-mail template isn't returning the correct image URL. Can you please help me to find the reason bewind the error? Thank you.

Best regards

sbluege
Hi,

is that code snippet correct? Why do you have that slash in front? Why do you think, it is not the correct url?

EnduranceCode
Hi Sven,

I'm sorry. something went wrong when I pasted the code. There's no slash, the code I'm using is as following:

<img src="https://www.svenbluege.de/{$lineitem->thumburl}">


It's not the correct URL because the e-mail doesn't show any image, now I'm attaching a screnshot of the e-mail.

The URL returned by the above code is the following:
https://ci4.googleusercontent.com/proxy/T9xzZ8Dackr18gATTajUWIkISzT8snY9IIGlrqCC3rvYyvlLhrrWpkyVmHT8D62McpHjQWNaScQ9HP8nyPkK_qeCHDUASSar6BpuZ9H-TeXWmWgfbiyzFxthlTsSYGU4GAn_oIGJSi1tWa5Z8QjrQSLzpGsBTEE5WBt6rxBeQtk0HLyhnCxGCbCZJ7oNoL1tmRBUe12jYz2TuH427IgPWLnrsocKkjRUjJwnB5WFYOW61doKQs-y-OZIqw=s0-d-e1-ft#http://triatl3ta.lcl/fotos/festa-triatlo-gala-fe-no-triatlo/download?task=mailthumb&orderid=109100798804978602604260426&lineitemid=153&token=5a3efe277a8386.40225202


and I would expect something similar to the following URL:
https://lh3.googleusercontent.com/-MkkPvdEjY1Y/WiRiHOkNgqI/AAAAAAAAjN0/OHLL9agk4Cgz-DHhrvCcohG5KoBXgI1HgCHMYBhgL/s1280/2017-12-02-10014-aa001wm.JPG


What I'm really looking for is the last part of this last URL (2017-12-02-10014-aa001wm.JPG) because it's the filename I've used when I've uploaded the file to Google Photos and that's this filename that I need to more quickly identify the photo that has been selled.

Thank you very much.

EnduranceCode
I must be doing somethithi really wrong when I paste de "smarty" code. There is no slassh in the code, the code I'm usig is <img src="https://www.svenbluege.de/{$lineitem->thumburl}">

EnduranceCode
<img src="https://www.svenbluege.de/{$lineitem->thumburl}">

EnduranceCode
The slash is added afte I hit "Send your Reply" button.

sbluege
Don't worry about the slash stuff. The ticket system seems to perform some unwanted magic here.

So the URL to a thumbnail in a mail is always like this:

http://triatl3ta.lcl/fotos/festa-triatlo-gala-fe-no-triatlo/download?task=mailthumb&orderid=109100798804978602604260426&lineitemid=153&token=5a3efe277a8386.40225202

This is necessary to make password protected stuff available through a more or less public URL.

Where is the domain triatl3ta.lcl coming from?

EnduranceCode
The domain triatl3ta.lcl a Virtual Host I've cretaed in my computer for development purpose. The live domain is triatl3ta.pt.

So, how can I get the filename I've used to upload to Google Photos?

sbluege

In the email you can't. Why would you like to do this? People get the download URL in an additional email once the order is paid. Of course only if you use the download shipping method.

Regarding your vhost: Google can't access those images. If you use a mail test server like mailhog you can test your mails locally.

EnduranceCode
I want to do that because I'm not using the download shipping method.

I'm using Google Photos to store and display the images with a watermark, therefore I'm not uploading the original photo files to my website (this setup saves storage space in my web host).

I need the file name uploaded to Google Photos because that's the fasttest way to identify the purchased photos.

sbluege

In this case, please have a look at the JSON below the email template. It contains additional information which you can use. One is the identifier of the album, the other one is the file name. Does this help?

EnduranceCode
I see the file name displayed in the e.mail and saved in the "orders" section of the component. The problem is that in the casse of images stored in Google Photos, the folder name and the file name is justa a bunch of numbers that are of no help (it's seen in the screenshoot I've sent before). What I'm aiming and need is the file used to upload the files to Google Photos "getThumbUrl()" get it but it isn't being saved anywhere.

sbluege
You can try this:

<a href="https://www.svenbluege.de/{$lineitem->imageurl}">
<img src="https://www.svenbluege.de/{$lineitem->thumburl}">
</a>

Of course without those leading slashes :)




EnduranceCode
Hi Sven,

I've taken a closure look to th JSON file and I've tested with <img src="https://www.svenbluege.de/{$lineitem->imageurl}"> instead of <img src="https://www.svenbluege.de/{$lineitem->thumburl}"> and now it shows the image and the URL is like I need (https://lh3.googleusercontent.com/-MkkPvdEjY1Y/WiRiHOkNgqI/AAAAAAAAjN0/OHLL9agk4Cgz-DHhrvCcohG5KoBXgI1HgCHMYBhgL/s1280/2017-12-02-10014-aa001wm.JPG).

So I believe that with some truncate function I will be able to show the filename in the e-mail and I will be able to solve my problem.

Since, $lineitem->thumburl isn't showing any image I would believe that something is wrong with the code. I'll test it in the live website and will then let you know.

I'm sure that the file name used to upload files to Google Photos will be necessary to every Eventgallery's user that uses Googole Photos. Therefore, I believe that would be more usefull to everyone who uses Google Photos. Therefore I sugest/request that EventGallery save that filename instead of the bunch of numbers is know saving.

Thank you very much

sbluege
From my perspective, Google Photos and selling images does not really work. Having the file name is just a coincidence since it is stored in a caption field.

A simple string operation can look like that: {$lineitem->imageurl|regex_replace:"/.*\//":""}

It'll output the "foo.jpg" of the image url and should do what you need.

EnduranceCode
Hi Sven,

Thank you for your help, your code performed the needed "magic".

Can you please elaborate why you believe that "Google Photos and selling images does not really work". Thank you.

sbluege
Sure.

- no reliable relation to the original file => hard to manually collect the files
- no option to allow direct downloads safely
- Google Picasa API is unreliable. They might close it down or do other stuff with it

Saving storage is a good argument. Still, you need to pay for it. So you could use Amazon S3 or local storage as well.

EnduranceCode
Hi Sven,

Thank you very much.

Have a Merry Christhmas.

Best regards