Community @ The Turning Gate

Support community for TTG plugins and products.

NOTICE

The Turning Gate's Community has moved to a new home, at https://discourse.theturninggate.net.

This forum is now closed, and exists here as a read-only archive.

  • New user registrations are disabled.
  • Users cannot create new topics.
  • Users cannot reply to existing topics.

You are not logged in.

#1 2014-10-03 21:42:19

Phoentje
Member
Registered: 2013-10-21
Posts: 120

Add code to each image(thumb)

Hi, is it possible to put extra code on each thumbnail generated by lightroom?

I want to place some JavaScript in the index. That should not be a problem. But this Java Script expects certain code on each thumbnail. With this code it can order real products in certain webshops (Like printouts on pencils, mugs etc)

The real question is then if it is possible to give each thumbnail some extra code within the IMG tag.

Is the cart using code like :
<div id=”gallery”>   <img src=”/albums/image1.jpg” height=”600” width=”400” /> </div> ?

And if so can I have it automated be filled with extra info within that line?

Thanks!

Offline

#2 2014-10-03 22:02:54

Ben
Moderator
From: Melbourne, Australia
Registered: 2012-09-29
Posts: 4,399

Re: Add code to each image(thumb)

Is there a certain third-party site or product you'd like the gallery to work with?  What would the extra code contain?

If the extra contents can be derived from the img tag or a parent element, then you could try crafting some custom JavaScript or jQuery prior to the extra script you're trying to run, that adds the necessary attributes to the img tag.

Offline

#3 2014-10-07 15:44:08

Phoentje
Member
Registered: 2013-10-21
Posts: 120

Re: Add code to each image(thumb)

Hi Ben, yes is the answer. The product I am trying to add, adds a picture on top of the thumb wich should redirect the customer to a webshop to order certain product.

They ask me to add some Javascript in de HEAD of my website. Something like:
<script type="text/javascript" src="http://www.website.nl/index.php/affiliate/script/index/key/b516e95asdae26662ff be9b42d8d9f7b256a212cf"></script>

Then they ask me if the current IMG tag would be

<div id=”gallery”>   <img src=”/albums/image1.jpg” height=”600” width=”400” /> </div> 

to change it like

<div id=”gallery”>   <img src=”/albums/image.jpg” foto=”/spanje/image1.jpg” height=”600” width=”400” /> </div>

So they want me to have all IMG within a DIV.

Offline

#4 2014-10-07 16:36:17

Matthew
Administrator
From: San Francisco, CA
Registered: 2012-09-24
Posts: 5,795
Website

Re: Add code to each image(thumb)

I don't know whether you can talk to anyone over there, but if that's all they want to do, then there are better ways of going about it. Shoving an invalid "foto" attribute into your img tag is not only annoying, but it's structurally invalid HTML, which makes it bad web-design.

Instead, at least in our case, they could fetch the same piece of information using:

$('a.image-link').attr('href');

... without your having to put invalid garbage into your gallery structure.


Matt

The Turning Gate, http://theturninggate.net

Offline

#5 2014-10-07 17:00:10

Phoentje
Member
Registered: 2013-10-21
Posts: 120

Re: Add code to each image(thumb)

Thanks Matthew, ill get back on this. Will ask them where this goes beyond my knowledge tongue

Offline

#6 2014-10-07 17:42:16

Phoentje
Member
Registered: 2013-10-21
Posts: 120

Re: Add code to each image(thumb)

Hi Matthew some more info btw (still waitin for an answer).
What they try to do is

<div id=”gallery”>   <img src=”/albums/image.jpg” foto=”/spanje/image1.jpg” height=”600” width=”400” /> </div> 

Where the ID foto is the place where the original picture is located (on ftp for example)

So this way with the script in the head connects to their shop.. then after this with the extra ID the thumbnail can be redirected to the original file on ftp.

With the example of you above you don't put a new image on top of the thumbs?

Offline

#7 2014-10-07 18:24:43

Phoentje
Member
Registered: 2013-10-21
Posts: 120

Re: Add code to each image(thumb)

Translation of the answer from the support team:

Matthew is correct. This is not the best solution on code level.
The meaning of the foto tag is, is that within this the path is noted where the image is located on the ftp server. This path is different than the path selected on the image (thumb with watermark etc).
With Matthews solution we gather the path of the image only with the copyright sign in it. Not the full res photo.

So we need to create a path where the script recognizes to gather it somewhere else.

Offline

#8 2014-10-07 22:01:31

Matthew
Administrator
From: San Francisco, CA
Registered: 2012-09-24
Posts: 5,795
Website

Re: Add code to each image(thumb)

in which case, you will need to hack the template to insert the necessary information.

Another point, though, is that if the source code contains the path to the for-sale image rendition, then users can simply access those files directly to download them, without making a purchase. Not the best way to go about selling your images.


Matt

The Turning Gate, http://theturninggate.net

Offline

#9 2014-10-07 22:05:24

Phoentje
Member
Registered: 2013-10-21
Posts: 120

Re: Add code to each image(thumb)

Nah those files would be located with the same path/name on a different FTP server. So you would still need a username/password to gather those.

But as you mention above I understand this is not possible for me to achieve? There is no simple way to give each file I upload trough TTG LR Plugin a different extra info into the code?

Offline

#10 2014-10-08 00:53:47

Matthew
Administrator
From: San Francisco, CA
Registered: 2012-09-24
Posts: 5,795
Website

Re: Add code to each image(thumb)

Not without hacking the template ...

Though I had another thought. If I remember correctly, the CE3 gallery used the image file name as anchor ID:

<a id="image-filename" ... 

So we could put it all together using Javascript as before, if your people are willing to cooperate.

var image = $('a.image-link').attr('id'), 
    foto  = "/spanje/" + image + ".jpg";

Matt

The Turning Gate, http://theturninggate.net

Offline

#11 2014-10-08 03:48:03

Phoentje
Member
Registered: 2013-10-21
Posts: 120

Re: Add code to each image(thumb)

I will send this to the support team.

Is it easier for achieve when I go for the CE4? As before I did not have a 200% reason to get the newest verison but if it makes life easier I might big_smile

Offline

#12 2014-10-08 05:58:01

Ben
Moderator
From: Melbourne, Australia
Registered: 2012-09-29
Posts: 4,399

Re: Add code to each image(thumb)

Do you have a working site we can look at?  I'm interested in seeing what you're trying to do with the cart.

Offline

#13 2014-10-08 13:04:05

Matthew
Administrator
From: San Francisco, CA
Registered: 2012-09-24
Posts: 5,795
Website

Re: Add code to each image(thumb)

Ben wrote:

Do you have a working site we can look at?  I'm interested in seeing what you're trying to do with the cart.

If I'm understanding the situation correctly, this actually has nothing to do with the cart, and all to do with the gallery. I think he's trying to implement a Fotomoto-like service, but one that's local to the Netherlands.


Matt

The Turning Gate, http://theturninggate.net

Offline

#14 2014-10-08 17:28:11

Phoentje
Member
Registered: 2013-10-21
Posts: 120

Re: Add code to each image(thumb)

Ben wrote:

Do you have a working site we can look at?  I'm interested in seeing what you're trying to do with the cart.


Yes, take a look at this example. http://developmentone.printjecanvas.nl/demo/walibi/

Offline

#15 2014-10-09 18:15:24

Phoentje
Member
Registered: 2013-10-21
Posts: 120

Re: Add code to each image(thumb)

Hi Matthew, indeed it is something simulair as that fotomoto site.
Update from the support team is that they can not adjust their side.. so my question then would be if this adjustment could be made in CE4 to put the tag there. If so ofcourse I will buy it and implement it!

If you can edit it for me in CE3 I would ofcourse also be a happy person. Ha ha

Offline

#16 2014-10-09 19:04:12

Matthew
Administrator
From: San Francisco, CA
Registered: 2012-09-24
Posts: 5,795
Website

Re: Add code to each image(thumb)

It's not something I'm going to build into the plugin, as that would be pointless. But you can edit your exported template to patch in the necessary code.


Matt

The Turning Gate, http://theturninggate.net

Offline

#17 2014-10-10 05:06:18

Phoentje
Member
Registered: 2013-10-21
Posts: 120

Re: Add code to each image(thumb)

Matthew wrote:

It's not something I'm going to build into the plugin, as that would be pointless. But you can edit your exported template to patch in the necessary code.

Ok that is a pitty but understandable. Any chance to help me into the right direction. What to edit and where? I am complete blank on this one unfortunately

Offline

#18 2014-10-10 13:25:53

Matthew
Administrator
From: San Francisco, CA
Registered: 2012-09-24
Posts: 5,795
Website

Re: Add code to each image(thumb)

Without knowing which options you've selected for your export, and whether or not you're using publisher, I cannot say. I'd need to see your exported template. And this would probably be a better conversation to have about the CE4 version, as I'm more familiar with that code at present; I haven't looked at CE3 in a very long time.


Matt

The Turning Gate, http://theturninggate.net

Offline

#19 2014-10-10 15:27:44

Phoentje
Member
Registered: 2013-10-21
Posts: 120

Re: Add code to each image(thumb)

Ok. This will be a winterjob for me though tongue , migrating to CE4 cart and such. I am using publisher.
If we can agree on fixing it I will make the purchase on the new CE4 in December or so.

Offline

#20 2014-10-10 16:27:08

Matthew
Administrator
From: San Francisco, CA
Registered: 2012-09-24
Posts: 5,795
Website

Re: Add code to each image(thumb)

Nothing needs to be "fixed". You're hacking it.


Matt

The Turning Gate, http://theturninggate.net

Offline

#21 2014-10-10 17:54:43

Phoentje
Member
Registered: 2013-10-21
Posts: 120

Re: Add code to each image(thumb)

Matthew wrote:

Nothing needs to be "fixed". You're hacking it.

Fixing it for me lol smile Yeh you are right. Hacking it.. And not that you have to put all time in it but pointing me in the right direction smile

Offline

Board footer

Powered by FluxBB