Member
Member
Ierdna   2018-03-03, 18:54
#1
Hi,

I use zpBootstrap Version 2.1 with isotope jQuery plugin enabled.
Is it possible to print also the image description under the image title?

Zenphoto-Version 1.4.14

Thank you!
Ierdna
Member
Member
vincent3569   2018-03-04, 14:15
#2
hi
it is not possible for now.
I will consider it, but it seems to not look very nice.
maybe an "on over" display of titles will be better.
stay tuned...
Member
Member
Ierdna   2018-03-04, 17:36
#3
Thank you Vincent.
Member
Member
Ierdna   2018-03-05, 19:08
#4
Hi Vincent,

I found a way to show image description under the image.
File to edit: album_isotope.php
I added <?php echo getBareImageDesc(); ?> in the following line.

<div class="isotope-item image-item<?php echo $class; ?>">
<a class="thumb" href="<?php echo html_encode(getUnprotectedImageURL()); ?>" title="<?php echo getBareImageTitle(); ?><?php echo getBareImageDesc(); ?>" data-fancybox="images">

Regards,
Ierdna
Member
Member
vincent3569   2018-03-06, 09:41
#5
yes of course, I know how to do.
maybe I'm wrong, but I think the result may not have a very good "look and feel"
Member
Member
wibbi   2018-03-09, 12:11
#6
You can extend the PHP code. All PHP is allowed.

<pre>[code]<?php echo "
" . getBareImageDesc(); ?>[/code]</pre>
EDIT: OK, it's a conflict with HTML code about the ```<``` and ```>```.

Is that also possible?
<pre>[code]<?php echo '' . getBareImageDesc() . ''; ?>[/code]</pre>
Then you can style it.
EDIT: OK, it's a conflict with HTML code about the ```<``` and ```>```.

I prefer this for the descriptions.
<pre>[code]<?php echo nl2br(getImageDesc()); ?>[/code]</pre>

This will take over the descriptions 1:1 from the editor. There are no ```
``` necessary. Line breaks are automatically converted to ```
```. This makes writing the descriptions easier. In addition, HTML code is still possible, also ```
```.

But, unfortunately, every HTML tag with ```<``` and ```>``` causes problems with the method of grabbing the text from the HTML img tag title. A better method would be the description in a div box with ```display:none``` to write and extract from it with JavaScript.
Member
Member
wibbi   2018-03-10, 15:56
#7
@lerdna
Solution: use ```htmlspecialchars()```. It's more secure. Don't destroy the HTML validation.

<pre>[code]<?php echo htmlspecialchars(getBareImageDesc()); ?>[/code]</pre>
or
<pre>[code]<?php echo htmlspecialchars(strip_tags(getBareImageDesc())); ?>[/code]</pre>

However, you can then use no HTML code in the description, because every HTML code is striped / converted.

Look here for more Info:
http://php.net/manual/en/function.htmlspecialchars.php
http://php.net/manual/en/function.strip-tags.php
Administrator
Administrator
acrylian   2018-03-10, 16:57
#8
Zenphoto actually has some internal functions for output encoding of text fields like that does not destroy html:
http://docs.zenphoto.org/function-html_encode.html

There are also some `sanitize` functions for sensitive data.

Also all `bare` functions already clear html by definition (to be use for example within attributes of html elements). No need to strip tags again actually. htmlspecialchars of course can make sense if you need to be sure that special chars work in your encoding used.
Member
Member
Ierdna   2018-03-10, 19:10
#9
Thank you wibbi. after checking some descriptions I found out some truncated.
I use this:
<?php echo htmlspecialchars(strip_tags(getBareImageDesc())); ?> and now is fine.
Member
Member
wibbi   2018-03-15, 18:38
#10
@lerdna, use it also for the title and all is valid and secure.

When you don't write HTML code like a link ```<a href="">``` in your title and description, you can remove the strip_tags().

```<?php echo htmlspecialchars(getBareImageTitle()); ?>```
```<?php echo htmlspecialchars(getBareImageDesc()); ?>```
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.