Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

  1. Index
  2. » Plugin support
  3. » smd_slimbox

#256 2007-09-14 12:43:56

Simanek
New Member
From: Lincoln, Nebraska, U.S.A.
Registered: 2007-09-12
Posts: 5
Website

Re: smd_slimbox

Bloke wrote: Consider it done. The automatic way is too much hassle (and slow) so I opted for adding an option instead.

Of course, since generally every thumbnail would be the same, this is a very simple and elegant solution. Nicely done! Thank you!

Offline

#257 2007-09-18 12:00:19

lee
Member
From: Normandy, France
Registered: 2004-06-17
Posts: 831

Re: smd_slimbox

Hey Stef, I’m getting Badly formed or empty plugin code, when installing smd_slimbox_v0.29.txt on TxP 4.05.

Offline

#258 2007-09-18 12:11:27

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,428
Website GitHub

Re: smd_slimbox

lee wrote:

I’m getting Badly formed or empty plugin code, when installing smd_slimbox_v0.29.txt on TxP 4.05.

Weird, I’m not. Try the direct link to the .txt file in case there’s something wrong with the one in the zip file.

Isn’t that error often to do with the plugin being too big? I thought the file limit was 100kB for plugins… or is it 64kB? In which case I’m perilously close to the max. Maybe I should leave the help out and just include it as a separate file in the archive. Or as online docs.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#259 2007-09-18 12:13:29

lee
Member
From: Normandy, France
Registered: 2004-06-17
Posts: 831

Re: smd_slimbox

Same problem.

Offline

#260 2007-09-18 13:00:48

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,428
Website GitHub

Re: smd_slimbox

lee wrote:

Same problem.

No idea then. Perhaps try the version I just made without the help text in it? In case it’s a size issue.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#261 2007-09-18 13:10:55

lee
Member
From: Normandy, France
Registered: 2004-06-17
Posts: 831

Re: smd_slimbox

That did the trick, thanks for your help Stef.

Offline

#262 2007-09-18 13:29:33

decoderltd
Member
From: London
Registered: 2006-06-20
Posts: 248
Website

Re: smd_slimbox

Bloke wrote:
Rules to allow arbitrary splitting / grouping of thumbnails like you need is definitely something I want to do. It’s the missing piece of the puzzle that also allows me to make the thumbnail-generation side more generic from the display side and allow me to split the functionality to offer bolt-on modules for slideshows / moonbox / popups and the like.

Thanks Stef, looking forward to that.

Offline

#263 2007-09-19 09:35:29

DrRogg
New Member
From: Tokyo, Japan
Registered: 2007-09-18
Posts: 4
Website

Re: smd_slimbox

Great plugin, I’m using php to grab an image ID from a custom field and send it straight to Slimbox. But whenever I close an image window a huuuuge blank space gets added onto the bottom of the page… Any ideas why?

Offline

#264 2007-09-19 18:33:10

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,428
Website GitHub

Re: smd_slimbox

DrRogg wrote:

I’m using php to grab an image ID from a custom field and send it straight to Slimbox.

I assume you have a good reason to do it that way rather than using slimbox in a form with imageid="?custom_field_name"

whenever I close an image window a huuuuge blank space gets added onto the bottom of the page…

Strange. I’ve only ever seen big blank spaces appear when you click an image thumbnail and the page cannot find the slimbox.css file. But in those instances (from memory) you also don’t get the image floating over the rest of the page; since you say this occurs when you close the image window I don’t think it applies in this case.

Can you post a page URL I can look at? Or some relevant code from your site? That might give me a clue.

Last edited by Bloke (2007-09-19 18:34:16)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#265 2007-09-19 19:52:19

Ambitiouslemon
New Member
From: DC
Registered: 2007-09-19
Posts: 6
Website

Re: smd_slimbox

I get the following error when trying to use the thumbsize option

Tag error: <txp:smd_slimbox category=“gallery” thumbsize=“128,” /> -> Warning: preg_split() expects parameter 4 to be long, string given on line 160

textpattern/lib/txplib_misc.php(446) : eval()’d code:160 preg_split()
textpattern/lib/txplib_misc.php(534) : eval()’d code:402 smd_splitRange()
textpattern/publish.php:963 smd_slimbox()
processTags()
textpattern/publish.php:922 preg_replace_callback()
textpattern/publish/taghandlers.php:1812 parse()
textpattern/publish.php:963 body()
processTags()
textpattern/publish.php:922 preg_replace_callback()
textpattern/lib/txplib_misc.php:1383 parse()

Tag error: <txp:smd_slimbox category=“gallery” thumbsize=“128,” /> -> Warning: Invalid argument supplied for foreach() on line 161

textpattern/lib/txplib_misc.php(534) : eval()’d code:402 smd_splitRange()
textpattern/publish.php:963 smd_slimbox()
processTags()
textpattern/publish.php:922 preg_replace_callback()
textpattern/publish/taghandlers.php:1812 parse()
textpattern/publish.php:963 body()
processTags()
textpattern/publish.php:922 preg_replace_callback()
textpattern/lib/txplib_misc.php:1383 parse()
textpattern/publish.php:782 parse_form()

Tag error: <txp:smd_slimbox category=“gallery” thumbsize=“128,” /> -> Notice: Undefined offset: 0 on line 408

textpattern/publish.php:963 smd_slimbox()
processTags()
textpattern/publish.php:922 preg_replace_callback()
textpattern/publish/taghandlers.php:1812 parse()
textpattern/publish.php:963 body()
processTags()
textpattern/publish.php:922 preg_replace_callback()
textpattern/lib/txplib_misc.php:1383 parse()
textpattern/publish.php:782 parse_form()
textpattern/publish.php:808 doArticle()

Tag error: <txp:smd_slimbox category=“gallery” thumbsize=“128,” /> -> Notice: Undefined offset: 1 on line 409

textpattern/publish.php:963 smd_slimbox()
processTags()
textpattern/publish.php:922 preg_replace_callback()
textpattern/publish/taghandlers.php:1812 parse()
textpattern/publish.php:963 body()
processTags()
textpattern/publish.php:922 preg_replace_callback()
textpattern/lib/txplib_misc.php:1383 parse()
textpattern/publish.php:782 parse_form()
textpattern/publish.php:808 doArticle()

Tag error: <txp:smd_slimbox category=“gallery” thumbsize=“128,” /> -> Notice: Undefined offset: 0 on line 410

textpattern/publish.php:963 smd_slimbox()
processTags()
textpattern/publish.php:922 preg_replace_callback()
textpattern/publish/taghandlers.php:1812 parse()
textpattern/publish.php:963 body()
processTags()
textpattern/publish.php:922 preg_replace_callback()
textpattern/lib/txplib_misc.php:1383 parse()
textpattern/publish.php:782 parse_form()
textpattern/publish.php:808 doArticle()

Tag error: <txp:smd_slimbox category=“gallery” thumbsize=“128,” /> -> Notice: Undefined offset: 1 on line 412

textpattern/publish.php:963 smd_slimbox()
processTags()
textpattern/publish.php:922 preg_replace_callback()
textpattern/publish/taghandlers.php:1812 parse()
textpattern/publish.php:963 body()
processTags()
textpattern/publish.php:922 preg_replace_callback()
textpattern/lib/txplib_misc.php:1383 parse()
textpattern/publish.php:782 parse_form()
textpattern/publish.php:808 doArticle()

Emi’s Bearhugs for Bravery

site: http://emisbearhugs.ambitiouslemon.com/gallery/

Offline

#266 2007-09-19 22:48:10

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,428
Website GitHub

Re: smd_slimbox

Ambitiouslemon wrote:

Warning: preg_split() expects parameter 4 to be long, string given on line 160

Eeeek! I can’t get that error so I guess my version of PHP must be inferior :-( Since I can’t replicate it, can you please try something for me so I can fix it. Go into the smd_slimbox code and scroll down about 3/4 of the way to the bit that starts:

// Handle thumbsize

A few lines further on you’ll find this:

$thumbSizes = smd_splitRange(trim($thumbsize), ",\s", "");

Can you swap the last “” for a 0 (a zero), save and try it again, i.e:

$thumbSizes = smd_splitRange(trim($thumbsize), ",\s", 0);

I’m not convinced that’ll fix it, but it might. If it does, that’s cool.

If it doesn’t, swap it back to the “” version and edit smd_lib instead. Scroll down almost all the way to the bottom to find the function smd_splitRange( ... ) { part. Immediately after the next line [ $retarr = array(); ], replace the line [ $elems = preg_split( ... ) ] with this chunk of code:

if (is_numeric($pregOpt)) {
	$elems = preg_split('/['.$splitat.']+/', $str, -1, $pregOpt);
} else {
	$elems = preg_split('/['.$splitat.']+/', $str, -1);
}

And give that a whirl. It’s not pretty but it should get round my hack for now until I can rethink the function parameters.

Let me know which, if any, of those work and I’ll implement the best one.

The other errors you received were just a cascade from this one, so they should clear up once it’s fixed. I did, however spot one more small (undefined index warning) bug which I’ll also fix tomorrow when I apply this patch. It shouldn’t appear unless you’re in debugging mode and it’s only a warning so shouldn’t bother you too much.

Sorry for the poor code and having to get you to be my test engineer: my version of PHP thinks the code is fine, which is a blatant lie now I just looked at the function parameters more closely! Thanks for pointing out the problem.

Last edited by Bloke (2007-09-19 22:50:49)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#267 2007-09-20 03:06:36

DrRogg
New Member
From: Tokyo, Japan
Registered: 2007-09-18
Posts: 4
Website

Re: smd_slimbox

Here’s what I’m using at the moment:

<txp:if_custom_field name="Cover Image ID (Main)">
<txp:php>

$a = custom_field (array ('name' => 'Cover Image ID (Main)'));

echo smd_slimbox (array(
    'imageid' => $a,
    'limit' => '1',
    'showpagelinks' => '0',
));

</txp:php>
<txp:else />
<p>No cover available.</p>
</txp:if_custom_field>

I have moved the css file, to be fair (it shares a folder called “slimbox” with the JS files) but smd_slimbox_inc reflects that, and like you say, you’d expect it not to work at all.

I’ve tried using <txp:smd_slimbox imageid="?Cover Image ID (Main)" limit="1" showpagelinks="0" /> instead, but that doesn’t show anything :S

Last edited by DrRogg (2007-09-20 05:50:06)

Offline

#268 2007-09-20 14:08:32

Ambitiouslemon
New Member
From: DC
Registered: 2007-09-19
Posts: 6
Website

Re: smd_slimbox

Tried both of these fixes and neither worked (although with txp I’m never sure since it seems to like caching pages to make testing difficult).

If it would be helpful I could give you access to the admin pages.

Last edited by Ambitiouslemon (2007-09-20 14:30:18)

Offline

#269 2007-09-20 16:09:36

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,428
Website GitHub

Re: smd_slimbox

DrRogg wrote:

I have moved the css file, to be fair (it shares a folder called “slimbox” with the JS files) but smd_slimbox_inc reflects that, and like you say, you’d expect it not to work at all.

Hmm, can’t think of anything offhand. Let me have a think about it while I make dinner.

I’ve tried using <txp:smd_slimbox imageid="?Cover Image ID (Main)" limit="1" showpagelinks="0" /> instead, but that doesn’t show anything

Ah yes of course. Spaces in name maketh plugin cry. I’ve only ever seen it used with underscores and dashes because my programming background has always made me shy away from spaces in anything; filenames, the lot.

In your case, the tag is looking for imageIDs in a custom field called “Cover” (and finding nothing) and also trying to make sense of ImageIDs numbered: “Image”, “ID” and “(Main)”, none of which are numeric so the tag returns nothing.

I’ve since learnt a better way of splitting strings up so I may be able to allow spaces in the next revision of (probably) smd_lib. I’ll test it out tonight and let you know if it works.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#270 2007-09-20 16:19:34

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,428
Website GitHub

Re: smd_slimbox

Ambitiouslemon wrote:

Tried both of these fixes and neither worked (although with txp I’m never sure since it seems to like caching pages to make testing difficult).

Hmmm. Thought one of them would work. Maybe I need to think harder :-(

And yeah, cacheing is a pain when testing. Have you set Admin->Prefs->Advanced->Send “Last-Modified” header (under the Publish section at the bottom) to “no”? That might help.

If it would be helpful I could give you access to the admin pages.

If you’re sure you don’t mind me poking about in the code then yes thank you that would be a big help. I’ll be as quick as I can. Let me know when would be the best time for you and send the details to me directly

Thanks.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

  1. Index
  2. » Plugin support
  3. » smd_slimbox

Board footer

Powered by FluxBB