thickbox

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
Imajica
Regular
Posts: 58
Joined: Mon Dec 05, 2016 6:26 pm
Location: Racine
Contact:

thickbox

Post by Imajica » Thu Apr 27, 2017 3:42 pm

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

User avatar
yellowled
Regular
Posts: 7037
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: thickbox

Post by yellowled » Thu Apr 27, 2017 4:36 pm

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
amazon Wishlist - Serendipity-Podcast (German only, sorry)

Imajica
Regular
Posts: 58
Joined: Mon Dec 05, 2016 6:26 pm
Location: Racine
Contact:

Re: thickbox

Post by Imajica » Thu Apr 27, 2017 5:18 pm

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

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: thickbox

Post by garvinhicking » Thu Apr 27, 2017 5:54 pm

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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

Imajica
Regular
Posts: 58
Joined: Mon Dec 05, 2016 6:26 pm
Location: Racine
Contact:

Re: thickbox

Post by Imajica » Fri Apr 28, 2017 12:22 am

regex gives me a headache ;)

User avatar
yellowled
Regular
Posts: 7037
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: thickbox

Post by yellowled » Fri Apr 28, 2017 12:36 pm

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
amazon Wishlist - Serendipity-Podcast (German only, sorry)

Post Reply