Search…

X3 Photo Gallery Support Forums

Search…
 
grimurnet
Experienced
Topic Author
Posts: 360
Joined: 17 Dec 2010, 04:50

Html version

18 Apr 2013, 04:01

Thanks for the reply Nick,
I get all the thumbnails, I would like to have image thumbnail instead of folder.png. Is that possible by changing some existing code? If so, where in the code? I'll try the description part
 
grimurnet
Experienced
Topic Author
Posts: 360
Joined: 17 Dec 2010, 04:50

Re: Html version

18 Apr 2013, 05:25

Nick wrote:If this code is in phtml file you can embed all data from the current folder, just look around in the existing code.

Thumbnail:
Code
<img src="<?php echo htmlspecialchars($this->folder->thumbnail); ?>
Title t() stands for translation in case you have a few languages:
Code
<?php echo (t($this->folder->getTitle())); ?>
Description
Code
<?php echo t($this->folder->description); ?>
I can't get the description to work, I have tried the following:

I get undefined here:
Code
beforeShow : function() {
    this.title = (this.index + 1) + ' / ' + this.group.length + '<br />' + (this.description)
    },
This breaks the code:
Code
beforeShow : function() {
    this.title = (this.index + 1) + ' / ' + this.group.length + '<br />' + (echo t($this->folder->description))
    },
This works, but displays the title, I would like to display description and or folder title
Code
beforeShow : function() {
    this.title = (this.index + 1) + ' / ' + this.group.length + '<br />' + (this.title)
    },
 
User avatar
Nick
Imagevue Hitman
Posts: 2872
Joined: 02 May 2006, 09:13

Re: Html version

20 Apr 2013, 00:57

Sorry, but you can't mix Javascript and PHP just like that. If this code is in phtml template, it should be something like this:
Code
beforeShow: function () {
    this.title =
        (this.index + 1) + ' / ' 
        + this.group.length + '<br />' +

        '<?php echo t($this->folder->description) ?>'
        // Php echoes variable into the javascript string 

},
firedev.com
 
grimurnet
Experienced
Topic Author
Posts: 360
Joined: 17 Dec 2010, 04:50

Re: Html version

20 Apr 2013, 07:34

Nick wrote:Sorry, but you can't mix Javascript and PHP just like that. If this code is in phtml template, it should be something like this:
Code
beforeShow: function () {
    this.title =
        (this.index + 1) + ' / ' 
        + this.group.length + '<br />' +

        '<?php echo t($this->folder->description) ?>'
        // Php echoes variable into the javascript string 

},
Thanks Nick, of course, silly me.
Now there is only one thing left that I would like to do, is there a trick to have photo thumbnail instead of folder.png have the actual image thumb, maybe the most recent image in the folder. I know there is info on how to do that in the flash version but how is it done in the html version?
 
User avatar
Nick
Imagevue Hitman
Posts: 2872
Joined: 02 May 2006, 09:13

Re: Html version

21 Apr 2013, 09:00

Here is how you get the path to the preview image:
Code
<?php if ($this->folder->previewimage) echo ivMapperFactory::getMapper('file')->find($this->folder->getPrimary() . $this->folder->previewimage)->getPath() ?>
firedev.com
 
grimurnet
Experienced
Topic Author
Posts: 360
Joined: 17 Dec 2010, 04:50

Re: Html version

21 Apr 2013, 12:57

Nick wrote:Here is how you get the path to the preview image:
Code
<?php if ($this->folder->previewimage) echo ivMapperFactory::getMapper('file')->find($this->folder->getPrimary() . $this->folder->previewimage)->getPath() ?>
Thanks for the reply, Nick.
What do I change to have a thumbnail from the folder instead of folder.png preview image? So that it grabs the first thumbnail from the folder to use as thumbnail.
Here is what I mean, I have changed the default thumbnail but I would like to have a actual photo from the specific folder as thumbnail preview
Screen Shot 2013-04-21 at 16.55.13.png
Screen Shot 2013-04-21 at 16.55.13.png (4.17 KiB) Viewed 14893 times
Is this possible?
 
User avatar
Nick
Imagevue Hitman
Posts: 2872
Joined: 02 May 2006, 09:13

Re: Html version

22 Apr 2013, 03:06

Code
<?php echo ivMapperFactory::getMapper('file')->find($this->folder->getPrimary() . $this->folder->previewimage)->thumbnail; ?>
Basically you just replace getPath() with thumbnail
firedev.com
 
grimurnet
Experienced
Topic Author
Posts: 360
Joined: 17 Dec 2010, 04:50

Re: Html version

22 Apr 2013, 07:52

Nick wrote:
Code
<?php echo ivMapperFactory::getMapper('file')->find($this->folder->getPrimary() . $this->folder->previewimage)->thumbnail; ?>
Basically you just replace getPath() with thumbnail
Thanks for the reply, but it doesn't seem to work. This should be put into index.html.phtml right?
But here is a changed html gallery, it is not perfect yet but I think I'm getting there. Maybe you could point out what could be better :-)

Here is the link: http://portfolio.grimur.net/?/
 
User avatar
Nick
Imagevue Hitman
Posts: 2872
Joined: 02 May 2006, 09:13

Re: Html version

22 Apr 2013, 11:03

If you're using it in the folders loop, then you would have to change $this->folder to $folder or something this way if you're inside the foreach() loop. Just look at the surrounding code that outputs folder information.
firedev.com
 
grimurnet
Experienced
Topic Author
Posts: 360
Joined: 17 Dec 2010, 04:50

Re: Html version

22 Apr 2013, 13:53

Nick wrote:If you're using it in the folders loop, then you would have to change $this->folder to $folder or something this way if you're inside the foreach() loop. Just look at the surrounding code that outputs folder information.
Can I add a photo that I only want as thumbnail for folder? So that I can force some photo from the folder with images and choose a photo to use as thumbnail.

Here is my code
Code

    <table>
      
        <td height="<?php echo $maxFolderHeight + 10; ?>"><?php if ($item->previewimage && ($file = ivMapperFactory::getMapper('file')->find($item->getPrimary() . $item->previewimage))) : ?>
         <?php if (ivPath::canonizeRelative(substr($file->thumbnail, 0, strlen($this->contentPath))) !== $this->contentPath): ?>
          <img onMouseOver="$(this).fadeTo('fast', 0.5)" onMouseOut="$(this).fadeTo('fast', 1)" onload="$(this).completed = 1; $(this).delay(60 * 1).fadeTo('fast', 1)" src="<?php echo $this->url(array('c' => 'xml', 'a' => 'thumb', 'path' => $file->getPrimary())) ?>" alt="" />
          <?php else: ?>
          <img onMouseOver="$(this).fadeTo('fast', 0.5)" onMouseOut="$(this).fadeTo('fast', 1)" onload="$(this).completed = 1; $(this).delay(60 * 1).fadeTo('fast', 1)" src="<?php echo htmlspecialchars($file->thumbnail) ?>?<?php echo htmlspecialchars($file->getThumbnailMTime()); ?>" class="thumbImage" alt="<?php echo htmlspecialchars($item->name); ?>"/>
          <?php endif; ?>
          <?php else: ?>
          <img onMouseOver="$(this).fadeTo('fast', 0.5)" onMouseOut="$(this).fadeTo('fast', 1)" onload="$(this).completed = 1; $(this).delay(60 * 1).fadeTo('fast', 1)" src="<?php echo htmlspecialchars($item->thumbnail); ?>?<?php echo htmlspecialchars($item->getThumbnailMTime()); ?>" width="90" height="80" alt="<?php echo htmlspecialchars($item->name); ?>"/>
          <?php endif ?>
</td>
    </table>

 
User avatar
Nick
Imagevue Hitman
Posts: 2872
Joined: 02 May 2006, 09:13

Re: Html version

22 Apr 2013, 23:11

Just drag it from the list to the preview image place in admin.
firedev.com
 
grimurnet
Experienced
Topic Author
Posts: 360
Joined: 17 Dec 2010, 04:50

Re: Html version

23 Apr 2013, 04:32

Thanks Nick, I have added it in the admin, but there is no way to hide the image. It is always visible below as a single photo. Is there a way to have only the thumb and hide the image?

Or if it is possible to hide image if the name is thumb.jpg or preview.jpg
 
User avatar
Nick
Imagevue Hitman
Posts: 2872
Joined: 02 May 2006, 09:13

Re: Html version

25 Apr 2013, 00:51

Yes, just name it _preview.jpg
firedev.com
 
grimurnet
Experienced
Topic Author
Posts: 360
Joined: 17 Dec 2010, 04:50

Html version

27 Apr 2013, 18:21

Ok I'll try that. Thanks :-) thanks for the help.
 
grimurnet
Experienced
Topic Author
Posts: 360
Joined: 17 Dec 2010, 04:50

Re: Html version

03 May 2013, 06:40

Where is the settings I can control the amount of thumbs I want in a row.
For instance if I want to have 10 thumbs side by side or as many as fit (depending on screen size).