Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2008-03-17 13:37:04

secundar
New Member
From: Pittsburgh
Registered: 2004-06-02
Posts: 8
Website

Re: smd_gallery: super-flexible gallery generator

Are there any examples for reading images from a directory? I’m receiving this error…

Tag error: <txp:smd_gallery directory="/images/gwar" match="JPG" form="gallery2" thumbsize="128," debug ="4" /> ->  Notice: Undefined variable: randsort  on line 205

Offline

#17 2008-03-17 15:18:53

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

Re: smd_gallery: super-flexible gallery generator

secundar wrote:

Are there any examples for reading images from a directory?

Err, currently no, sorry. But that error is just a warning due to me forgetting to set something in directory mode. When you put your site to Live it’ll disappear, but I will fix it in the next release. Thanks for letting me know.

My guess at the reason your directory version isn’t working is because of the way directories work in web land. If you specified the full server path to your images it’d work (e.g. /home/secundar/www/my_site/images/gwar). If your host has allowed fopen_url support you should also be able to specify the directory with the full URL as http://my_site.com/images/gwar. Unfortunately I am unable to test this because my hoster doesn’t allow it. Grrrr.

If you have asy_wondertag installed you may also be able to wrap it round smd_gallery and use: directory="<txp:site_url />images/gwar".

I’d be very interested in your experiences and whether it works because it’s almost totally untested at the moment. I threw it in the code because I thought it might be useful one day.

Sorry I can’t be of much more help right now but if you have any more problems with it, please let me know the details and I’ll try and fix the code based on your error messages and feedback. If you do get it working and would like to let me know how you got it going (tag/form etc) I can add it to the help file as an example too.

btw, is that ‘gwar’ as in the mad thrash metal band of the late 80s? ROCK :-)


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

#18 2008-03-17 16:13:47

secundar
New Member
From: Pittsburgh
Registered: 2004-06-02
Posts: 8
Website

Re: smd_gallery: super-flexible gallery generator

Thanks Stef,

I changed the site to Live and here’s what i get:

Fatal error: Call to undefined function smd_split() in /var/www/textpattern/lib/txplib_misc.php(574) : eval()'d code on line 258

Yes, it is the Gwar you speak of! I’ve got quite a few images I need to get up in a gallery so it looks like I’ll have to get them into the image tab to move forward today… And thanks for your plugin — very nice, and I’ll look forward to being able to use directories.

Cheers!

Offline

#19 2008-03-17 16:44:12

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

Re: smd_gallery: super-flexible gallery generator

secundar wrote:

Call to undefined function smd_split()

D’oh! Missed that one. Fix for that and the other warning is in v0.32 [ compressed ]

It’s just occurred to me looking through the code that I have not implemented sorting in directory mode either yet. I’ve added it to the ToDo list and when I get some feedback on how well (or not) the facility works I’ll expand its features. Thanks for being patient in these early stages.

Yes, it is the Gwar you speak of!

Sweeeeet. All hail the mighty GWAR and their unique brand of screaming vocals. And flinging dubious things into the crowd. Never made it to a gig but my friend at school said they were great.


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

#20 2008-03-17 17:57:58

secundar
New Member
From: Pittsburgh
Registered: 2004-06-02
Posts: 8
Website

Re: smd_gallery: super-flexible gallery generator

Ok, I gave it one last try with asy_wondertag as you recommended:

<txp:asy_wondertag><txp:smd_gallery directory="<txp:site_url />images/gwar"  form="gallery2" pageform="gallerypage"  limit="20" thumbsize="128," /></txp:asy_wondertag>

But it does not render the gallery images, nor does it give an error. The tag simply doesn’t like directory=“http://…” or directory=”/images/…”. Using the complete path on the server rendered the proper html but my server will not display images referenced like so: /var/www/images/gwar/…

I can continue testing if you can give me some tips but I’ll also need to continue setting up my pagination using the images I’ve added to the images tab. EDIT: I guess I didn’t quite understand pagination from the start: What I want to do is present the thumbnail index, then, clicking on a thumbnail will bring up a page (no popup) with the full-size image, with next and previous navigation below.

I hope I’m making sense. I don’t do much web design these days so I’m a little rusty.

Last edited by secundar (2008-03-17 18:11:20)

Offline

#21 2008-03-17 20:30:04

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

Re: smd_gallery: super-flexible gallery generator

secundar wrote:

Ok, I gave it one last try with asy_wondertag as you recommended… But it does not render the gallery images,

Ah yeah, bogus info again, sorry I’m half asleep. I wonder if the <img> or <a> tags will render full server images if given file:// as a prefix. I have no idea, but you can try it if you like.

The tag simply doesn’t like directory=“http://…”

That may be your server setting. A number of hosters disable fopen_url and it’s equivalents in an effort to try and thwart security attacks. Often misguidedly, imo, but that’s another story.

Sounds like, until I get my act together with the directory option (i.e. find a host who has fopen_url enabled, or just ditch support for directories), the images tab is the easiest way to manage pics in this case. Set up a category called ‘gwar’ and dump all your pics in there.

What I want to do is present the thumbnail index, then, clicking on a thumbnail will bring up a page (no popup) with the full-size image, with next and previous navigation below.

Hmmm, you mean, like this, but with thumbnails instead of text links ? (that site’s not currently made in TXP unfortunately).

I’m not sure any gallery script will handle that because it spans two pages. I messed about with conditionals and offsets and passing URLs around; I came close (very close) with smd_gallery but couldn’t quite get it to work (in fact I think I’ve uncovered some strangeness in the offset calculation but I’m not sure yet – if I find it’s a bug and fixing it helps in this case I’ll post this example as an extreme case of how mad you can get with smd_gallery!)

So I think if you want that sort of gallery you’ll probably have to resort to some PHP, pass the URL (or ID) of the image you want to display to the address bar, read it in and display it. Navigation will probably have to be done by hand as well, but that’s just my gut reaction. Someone else might be able to come up with a good way of doing it.

I’d suggest saving yourself some hassle and using a lightbox or similar gallery to “keep it all on one page” and navigate within the lightbox. Since you only want next/prev then it’s ideal, plus the thumbnails are always a click away behind the main image so your prospective visitors can jump around in the gallery as well.

Sorry it’s not exactly the answer you’d like. If I find a way of doing it neatly I’ll yell. In the meantime I’ll rebadge the smd_gallery description as something less glamorous so people don’t get their hopes up in future on the back of my half-assed coding! :-)

Last edited by Bloke (2008-03-17 20:30:31)


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

#22 2008-03-17 22:31:30

secundar
New Member
From: Pittsburgh
Registered: 2004-06-02
Posts: 8
Website

Re: smd_gallery: super-flexible gallery generator

Hey Stef, thanks so much for your thoughts…Yes, just like you have it on your site but I’m going to take your advice and try one of the pop-up options — hopefully something lightweight. I’ll update this thread when it’s up so you can see a couple shots of Gwar.

Some nice photos on your site BTW. I had a laugh, thanks!

Offline

#23 2008-03-21 03:47:25

nardo
Member
From: tuvalahiti
Registered: 2004-04-22
Posts: 743

Re: smd_gallery: super-flexible gallery generator

great work bloke

any chance of a <txp:smd_gallery id="?custom_field" ... />

tried using asy_wondertag to wrap around tag & injected txp:custom_field tag into the ID attribute – but no success immediately

Offline

#24 2008-03-21 15:32:17

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

Re: smd_gallery: super-flexible gallery generator

nardo wrote:

any chance of a <txp:smd_gallery id="?custom_field" ... />

D’oh! It was working up until the mod to v0.31 where I messed up the SQL query. Give 0.33 a go instead [ compressed ].

Sorry about that, thanks for spotting the bug.


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

#25 2008-03-23 19:10:16

fuls
Member
Registered: 2005-11-16
Posts: 117
Website

Re: smd_gallery: super-flexible gallery generator

Hi,
Great plugin!
I’m having a problem with the launch from one image.

This is my plugin tag:

<txp:smd_gallery category=“animals”
sublevel=“all” form=“gallery” thumblimit=“1” />

Form:

<a rel=“shadowbox[{category}]” href=”{url}” alt=”{alt}” title=”{category_title}: {title}” height=”{height}” width=”{width}”>
{object}
</a>

Form outputs the following code (there are currently 2 photos in this category):

<a rel=“shadowbox[Animals]” href=“http://my-site.com/images/12.jpg” alt=“Image” title=“Animals:Image” height=“595” width=“800”>
<img src=“http://my-site.com/images/12t.jpg” alt=“Image” />
</a>

<a rel=“shadowbox[Animals]” href=“http://my-site.com/images/11.jpg” alt=“Image” title=“Animals: Image” height=“587” width=“800”>
</a>

As you can see the second link is empty and it is causing me some problems. I see all the css styling for the link (background color, border), and of course no image.
What can I do to remove that?
I’m also getting validation output errors:

there is no attribute “alt”.
there is no attribute “height”.
there is no attribute “width”.

Thank you very much for your help!

Offline

#26 2008-03-23 19:46:01

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

Re: smd_gallery: super-flexible gallery generator

fuls wrote:

I’m having a problem with the launch from one image.

Ha! That would be my fault. The example is wrong (stupid copy ‘n’ paste error that I messed up). The validator is right: take out the alt=, height= and width= from the <a> tag.

You may also find that fixes the CSS, although it is a side-effect of the way the {object} tag works. What it does is “hides” the other images by not putting anything inside the anchor. I suggest what you do is wrap the smd_gallery call with a div (or use wraptag / class attributes) then change your CSS so it targets the img inside the anchor. That way, you’ll only be applying the CSS rule if the img is present.

So something like:

<div class="thumbs">
 <txp:smd_gallery blah blah />
</div>
.thumbs img {
  width:100px;
  background:#555;
...
}

Sorry about the bogus example in the help. I’ll fix that as soon as I can.


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

#27 2008-03-23 22:05:38

fuls
Member
Registered: 2005-11-16
Posts: 117
Website

Re: smd_gallery: super-flexible gallery generator

Great, it works now! Thanks.

Offline

#28 2008-03-23 22:40:10

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

Re: smd_gallery: super-flexible gallery generator

I liked this plugin too :)
P.S. Should you add link to 0.33 to the head of topic?


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

#29 2008-03-24 15:13:18

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

Re: smd_gallery: super-flexible gallery generator

@fuls: excellent. Sorry about the poor documentation.

@the_ghost. Oops, thanks for pointing that out. Updated now. I’d forgotten to update textpattern.org too.


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

#30 2008-03-25 12:59:29

nardo
Member
From: tuvalahiti
Registered: 2004-04-22
Posts: 743

Re: smd_gallery: super-flexible gallery generator

how do you output the thumbnail’s width and height (into the img tag) when thumbnails can be different sizes?

e.g. you wanted to approximate something like this – where your landscape and portrait thumbs sat centered in a slide frame

Offline

Board footer

Powered by FluxBB