Yoshi & Huub,
I've found an issue with the lightbox display of the text under the image.
The issue only occurs when there are multiple lines in the text to be displayed, and, I believe, easily fixed with a simple (hopefully) adjustment in the gedcom import.
When importing the gedcom tag 'TITL', there can be (and I have quite a lot) where there is a following 'CONT' tag to add an extra line (or lines). When imported into the database, these are being separated by a crlf, which, on the surface, seems t be fine.
However, when the code for lightbox is generated, the description text includes these crlf's. However, lightbox doesn't like this, and doesn't display any text under the image.
I believe the fix (I'll be testing it later today by editing my gedcom file & reloading the database) is to, instead of having a crlf between the TITL & CONT, and then between any further CONT tags, is to use the html <br> tag, so we don't 'break' the code to lightbox with crlf's, but retain the text going onto the following line. (Expect this to be an easier fix than finding every reference to this text & modifying it on the fly for use in lightbox - and it shouldn't impact displaying the text on any page as well).
Colin
[In version 5.8] Issue with lightbox code
Re: Issue with lightbox code - potential fix in gedcom import
Just checked, and changing the date to have the <br> instead of the crlf when storing the TITL/CONT/CONt works perfetly, and displays the text correctly, preserving the new lines in the output
- Huub
- HuMo-genealogy programmer
- Posts: 2693
- Joined: Wed 27 Aug 2008, 11:34
- Location: Heerhugowaard, Netherlands
- Contact:
Re: Issue with lightbox code - potential fix in gedcom import
Thanks for checking this problem! I allready noticed it, but didn't checked it yet. I didn't know the crlf was the problem!I believe the fix (I'll be testing it later today by editing my gedcom file & reloading the database) is to, instead of having a crlf between the TITL & CONT, and then between any further CONT tags, is to use the html <br> tag, so we don't 'break' the code to lightbox with crlf's, but retain the text going onto the following line. (Expect this to be an easier fix than finding every reference to this text & modifying it on the fly for use in lightbox - and it shouldn't impact displaying the text on any page as well).
It's better to change the text with every lightbox item, because I never store HTML items in the database. If there are HTML codes in the database, they will be exported in a GEDCOM export. And it's just not official GEDCOM code anymore. It could also be a problem in PDF and RTF export.
There is another reason not to do this in GEDCOM import: several users use the editor in HuMo-genealogy. So it's needed to do this in the photo scripts.
Maybe use the HuMo-genealogy function process_text() or use PHP nl2br or PHP htmlentities.
There are only two files where GLightbox is generated:
include/show_picture.php
photoalbum.php.
It's this line in the scripts:
Code: Select all
echo '<a href="'.$dir.$filename.'" class="glightbox3" data-gallery="gallery1" data-glightbox="description: '.str_replace("&", "&", $picture_text2).'">';
Code: Select all
echo '<a href="'.$dir.$filename.'" class="glightbox3" data-gallery="gallery1" data-glightbox="description: '.htmlentities($picture_text2).'">';
Code: Select all
$picture_text2=str_replace(array("\\r\\n", "\\r", "\\n"), "<br />", $picture_text2);
$picture_text2=htmlentities($picture_text2);
$picture_text2=nl2br($picture_text2);
echo '<a href="'.$dir.$filename.'" class="glightbox3" data-gallery="gallery1" data-glightbox="description: '.$picture_text2.'">';
I will check this later, I have some other items I want to solve first.
HuMo-genealogy update? Backup your database! Editing in HuMo-genealogy? Backup your data!
Make multiple backups with: PHPMyAdmin, gedcom export and database export.
HuMo-genealogy software: http://humo-gen.com
Make multiple backups with: PHPMyAdmin, gedcom export and database export.
HuMo-genealogy software: http://humo-gen.com
- Huub
- HuMo-genealogy programmer
- Posts: 2693
- Joined: Wed 27 Aug 2008, 11:34
- Location: Heerhugowaard, Netherlands
- Contact:
Re: Issue with lightbox code - potential fix in gedcom import
I probably found the solution, I didn't use the correct GLightbox options to show HTML codes. Glightbox uses a seperate <div> to show the HTML codes.
Replace this code:
In file photoalbum.php:
In show_pictures.php:
I will add these changes in the next version!
Replace this code:
Code: Select all
echo '<a href="'.$dir.$filename.'" class="glightbox3" data-gallery="gallery1" data-glightbox="description: '.str_replace("&", "&", $picture_text2).'">';
Code: Select all
echo '<a href="'.$dir.$filename.'" class="glightbox3" data-gallery="gallery1" data-glightbox="description: .custom-desc'.$picture_nr.'">';
echo '<div class="glightbox-desc custom-desc'.$picture_nr.'">'.$picture_text2.'</div>';
Code: Select all
$picture='<a href="'.$picture_array['path'].$picture_array['picture'].'" class="glightbox3" data-gallery="gallery'.$event_connect_id.'" data-glightbox="description: .custom-desc'.$media_event_id[$i].'">';
$picture.='<div class="glightbox-desc custom-desc'.$media_event_id[$i].'">'.$title_txt.'</div>';
HuMo-genealogy update? Backup your database! Editing in HuMo-genealogy? Backup your data!
Make multiple backups with: PHPMyAdmin, gedcom export and database export.
HuMo-genealogy software: http://humo-gen.com
Make multiple backups with: PHPMyAdmin, gedcom export and database export.
HuMo-genealogy software: http://humo-gen.com
Re: Issue with lightbox code - potential fix in gedcom import
Thanks Huub.
I'll check first chance I get - just home from major surgery - so not in a state to do much at the moment.
Colin
I'll check first chance I get - just home from major surgery - so not in a state to do much at the moment.
Colin
- Huub
- HuMo-genealogy programmer
- Posts: 2693
- Joined: Wed 27 Aug 2008, 11:34
- Location: Heerhugowaard, Netherlands
- Contact:
Re: Issue with lightbox code - potential fix in gedcom import
Hi Colin,
I hope you're fine now!
The lightbox script is improved in HuMo-genealogy version 5.8.
I hope you're fine now!
The lightbox script is improved in HuMo-genealogy version 5.8.
HuMo-genealogy update? Backup your database! Editing in HuMo-genealogy? Backup your data!
Make multiple backups with: PHPMyAdmin, gedcom export and database export.
HuMo-genealogy software: http://humo-gen.com
Make multiple backups with: PHPMyAdmin, gedcom export and database export.
HuMo-genealogy software: http://humo-gen.com
Re: [In version 5.8] Issue with lightbox code
Thanks
Going to take a while - was major surgery on my cervical spine
I've upgraded - but need to reload my data as I'd changed all the crlf to <br> - so need to reverse that.
(Found a new bug in latest - I'll put up a post on it seperately)
Colin
Going to take a while - was major surgery on my cervical spine
I've upgraded - but need to reload my data as I'd changed all the crlf to <br> - so need to reverse that.
(Found a new bug in latest - I'll put up a post on it seperately)
Colin