Page 1 of 1

thickbox

Posted: Thu Apr 27, 2017 3:42 pm
by Imajica
Morning Folks,

I've started going thru old posts, I migrated to Serendipity from NucleusCMS, and there are about 300 that I have to edit to make them work in Serendipity.

In NucleusCMS I used a plug-in called thickbox
syntax is

Code: Select all

<%ThickBox(http://www.myfavoritepinups.com/images/christinekill/christinekill1.jpg|Photo by Tim Hunter Photography)%> 
when thickbox was deprecated they added the thickbox variable into lightbox so we didn't have to go back and edit everything

question is can anyone think of a way to make this work without going back and redoing every post?

Thanks
John

Re: thickbox

Posted: Thu Apr 27, 2017 4:36 pm
by yellowled
Imajica wrote:syntax is

Code: Select all

<%ThickBox(http://www.myfavoritepinups.com/images/christinekill/christinekill1.jpg|Photo by Tim Hunter Photography)%> 
That's also what is in your entries' source code (in the database) after you imported your content to s9y? Urgh.
Imajica wrote:can anyone think of a way to make this work without going back and redoing every post?
Well, technically, you'd “just” have to replace the old markup with the new markup in the database to make this work. And although it might seem like wizardry, that is actually possible with the help of something called regular expressions. Not my expertise, sadly, but it's possible.

However, I would assume (someone correct me if I'm wrong; please check in your /uploads/ directory) that this also means that all the images are only available in your s9y database in the large format, so s9y would need to generate thumbnails (a lightbox link usually consists of a small image that is linked to a larger version). Also, you'd need to know which lightbox you want to use (our lightbox plugin offers 4, I'd recommend MagnificPopup) to know which markup the old code should be replaced with.

YL

Re: thickbox

Posted: Thu Apr 27, 2017 5:18 pm
by Imajica
yellowled wrote:That's also what is in your entries' source code (in the database) after you imported your content to s9y? Urgh.
Urgh is right :)
yellowled wrote:our lightbox plugin offers 4, I'd recommend MagnificPopup
I went with Lightbox 2 jquery... is it too late to change? ;)

I'm not storing images in the database... I'm using LiveWriter as an offline post editor and using that to ftp images up to my server, so no thumbs are generated on the serendipity side.. it's all on upload via livewriter

John

Re: thickbox

Posted: Thu Apr 27, 2017 5:54 pm
by garvinhicking
Hi!

Just a quick shot: with the serendipity_event_Regexpmarkup event plugin (available in spartacus) you should be able to transfer that markup on the fly.

The plugin ships with a regexp subdirectory where you can create a new file like "thickbox.php" with a content like this:

Code: Select all

$regexpArray = array(
    'SearchArray'=>array(
                '/<%ThickBox\([^\|]+)\|([^\)]+)%>/si'
        ),
    'ReplaceArray'=>array(
                '<a href="\1" rel="lightbox"><img src="\1" alt="\2" width="300" /></a>'
    )
); 
This has to caveats:

1.) It does not automatically create a thumbnail. As you can see, the original image file will be used and just rendered with a smaller image size.

2.) The regexps are executed everytime the entry is displayed, unless you use the caching entryproperties plugin. If you use that, make sure to clear the cache so that the plugin can take action on a fresh cache.

3.) I did not test this since I was running out of time, but I hope it gets you started. The regexps are not destructible, if they are wrong, you can try until they work [if you clear the cache if 2.) applies].

HTH,
Garvin

Re: thickbox

Posted: Fri Apr 28, 2017 12:22 am
by Imajica
regex gives me a headache ;)

Re: thickbox

Posted: Fri Apr 28, 2017 12:36 pm
by yellowled
Imajica wrote:I went with Lightbox 2 jquery... is it too late to change? ;)
For what it's worth: no, it's not. :)

The lightbox plugins generates code in a way (see the markup that Garvin's regexp is generating) that you can actually switch between the four lightboxes included. Everything else is just personal preference; my recommendation for magnificPopup is based upon the fact that it's rather new and very sound technically, but if you prefer Lightbox 2 oder any of the other, that's fine. And as I said – you should be able to just switch in back and forth in the plugin to test them all once it's working.

YL