Page 2 of 3

Html version

Posted: 18 Apr 2013, 04:01
by grimurnet
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

Re: Html version

Posted: 18 Apr 2013, 05:25
by grimurnet
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)
    },

Re: Html version

Posted: 20 Apr 2013, 00:57
by Nick
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 

},

Re: Html version

Posted: 20 Apr 2013, 07:34
by grimurnet
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?

Re: Html version

Posted: 21 Apr 2013, 09:00
by Nick
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() ?>

Re: Html version

Posted: 21 Apr 2013, 12:57
by grimurnet
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 14944 times
Is this possible?

Re: Html version

Posted: 22 Apr 2013, 03:06
by Nick
Code
<?php echo ivMapperFactory::getMapper('file')->find($this->folder->getPrimary() . $this->folder->previewimage)->thumbnail; ?>
Basically you just replace getPath() with thumbnail

Re: Html version

Posted: 22 Apr 2013, 07:52
by grimurnet
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/?/

Re: Html version

Posted: 22 Apr 2013, 11:03
by Nick
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.

Re: Html version

Posted: 22 Apr 2013, 13:53
by grimurnet
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>


Re: Html version

Posted: 22 Apr 2013, 23:11
by Nick
Just drag it from the list to the preview image place in admin.

Re: Html version

Posted: 23 Apr 2013, 04:32
by grimurnet
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

Re: Html version

Posted: 25 Apr 2013, 00:51
by Nick
Yes, just name it _preview.jpg

Html version

Posted: 27 Apr 2013, 18:21
by grimurnet
Ok I'll try that. Thanks :-) thanks for the help.

Re: Html version

Posted: 03 May 2013, 06:40
by grimurnet
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).