Announcement

  •  » Engine
  •  » How get the address of current image thumbnail?

#1 2012-06-03 18:33:54

EvilKant
Member
Russia
1970-01-01
98

How get the address of current image thumbnail?

I try create social buttom for russian social net on picture.tpl page.

Can I somehow get the address of current image thumbnail?

Offline

 

#2 2012-06-03 18:38:08

ddtddt
Piwigo Team
Quetigny - France
2007-07-27
7207

Re: How get the address of current image thumbnail?

for piwigo 2.3 or piwigo 2.4


You love Piwigo so don't hesitate to participate, learn more on the "Contribute to Piwigo" page. If you don't have much time for contribution, you can also help the project with a donation.

Offline

 

#3 2012-06-03 18:40:13

EvilKant
Member
Russia
1970-01-01
98

Re: How get the address of current image thumbnail?

ddtddt wrote:

for piwigo 2.3 or piwigo 2.4

And 2.3 and 2.4 :) .

Now I working with 2.3.4

Offline

 

#4 2012-06-03 19:10:09

ddtddt
Piwigo Team
Quetigny - France
2007-07-27
7207

Re: How get the address of current image thumbnail?

For 2.3
$picture['current']['thumbnail']


You love Piwigo so don't hesitate to participate, learn more on the "Contribute to Piwigo" page. If you don't have much time for contribution, you can also help the project with a donation.

Offline

 

#5 2012-06-03 19:18:25

ddtddt
Piwigo Team
Quetigny - France
2007-07-27
7207

Re: How get the address of current image thumbnail?


You love Piwigo so don't hesitate to participate, learn more on the "Contribute to Piwigo" page. If you don't have much time for contribution, you can also help the project with a donation.

Offline

 

#6 2012-06-03 19:32:06

EvilKant
Member
Russia
1970-01-01
98

Re: How get the address of current image thumbnail?

Can I do it with SMARTY?

Last edited by EvilKant (2012-06-03 19:38:27)

Offline

 

#7 2012-06-03 21:24:28

EvilKant
Member
Russia
1970-01-01
98

Re: How get the address of current image thumbnail?

Arrgg... I hate SMARTY.

I found current image thumbnail adress - {$current.thumbnail}. But now I need bind java sript function and SMARTY variables...

{footer_script}{literal}
function vkButton(rootURL, imageSRC)
{       
VK.Share.button({
  url: document.location.href,
  title: 'Picture Munchkin',
  description: 'Супергероини в трико и без',
  image: rootURL+imageSRC
});
       
        }{/literal}
{/footer_script}
    <a href="" onclick="vkButton({$ROOT_URL}, {$current.thumbnail})">vkButton</a>

Now I try that, but it didn't work and I don't know why.

In instruction for VK.Share.button written:

<script type="text/javascript">
<!--
document.write(VK.Share.button({
  url: 'http://mysite.com',
  title: 'Хороший сайт',
  description: 'Это мой собственный сайт, я его очень долго делал',
  image: 'http://mysite.com/mypic.jpg',
  noparse: true
}));
-->
</script>

But SMARTY will not let me use it, because I can't transfer the data from SMARTY in java script.

PS it's just me whining

Offline

 

#8 2012-06-03 21:32:10

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3277

Re: How get the address of current image thumbnail?

it should works, how looks the generated html ?

Offline

 

#9 2012-06-04 19:06:17

EvilKant
Member
Russia
1970-01-01
98

Re: How get the address of current image thumbnail?

mistic100 wrote:

it should works, how looks the generated html ?

in picture.tpl:

<script type="text/javascript">
{lang: 'ru'}
</script>
<a onclick="vkButton(, ./galleries/renato-camilo/thumbnail/TN-04_10_11_RC_BlackCat.jpg)" href="">vkButton</a>

in footer.tpl:

<script src="local/combined/vsdqw9.js" type="text/javascript">
/*BEGIN themes/default/js/ui/minified/jquery.ui.01.min.js */
;
/*BEGIN themes/default/js/ui/minified/jquery.ui.02.min.js */
;

jquery.ui.01.min.js is fading effect, and it is working.

Offline

 

#10 2012-06-04 19:18:54

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3277

Re: How get the address of current image thumbnail?

I think the VK button wants an absolute URL,
I will have to add some PHP to assign the root url

$template->assign('ABSOLUTE_ROOT_URL', get_absolute_root_url());

actually you can try this directly in the template, but not sure it will work

Code:

{php}
  global $template;
  $template->assign('ABSOLUTE_ROOT_URL', get_absolute_root_url());
{/php}

Last edited by mistic100 (2012-06-04 19:19:16)

Offline

 

#11 2012-06-04 19:20:31

flop25
Piwigo Team
2006-07-06
7037

Re: How get the address of current image thumbnail?

hum the PHP tag is removed in Smarty3 so it will be too in Piwigo2.5 : it's better to assign from php


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#12 2012-06-04 19:30:15

EvilKant
Member
Russia
1970-01-01
98

Re: How get the address of current image thumbnail?

I think somthing wrong in smarty construction {footer_script require='jquery.ui.01'} {/footer_script}
Because if I do without it, all is working, but without link on picture.

Offline

 

#13 2012-06-04 20:21:11

EvilKant
Member
Russia
1970-01-01
98

Re: How get the address of current image thumbnail?

How corect transfer in SMARTY that line:

<script type="text/javascript" src="http://vkontakte.ru/js/api/share.js?9" charset="windows-1251"></script>

Maybe error is here?

Offline

 

#14 2012-06-04 20:23:48

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3277

Re: How get the address of current image thumbnail?

{combine_script id="vk_share" path="http://vkontakte.ru/js/api/share.js"}

Offline

 

#15 2012-06-04 23:04:17

EvilKant
Member
Russia
1970-01-01
98

Re: How get the address of current image thumbnail?

Hrrr... You need smiles here :)

{combine_script id="vk_share" load='async' path="http://vkontakte.ru/js/api/share.js"}

{footer_script}{literal}
function vkButton(rootURL, imageSRC)
{       
document.write(VK.Share.button({
  url: document.location.href,
  title: 'Picture Munchkin',
  description: 'Супергероини в трико и без',
  image: rootURL+imageSRC
}));
}
       
        {/literal}
{/footer_script}

<body id="{$BODY_ID}" onLoad="vkButton('{$ROOT_URL}', '{$current.thumbnail}')">

it works! But the button appears in a new window :( . Now trying to replace "document.write" on jQuery... No result yet.

Offline

 
  •  » Engine
  •  » How get the address of current image thumbnail?

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact