Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2019-05-16 23:19:09

detail
Member
From: geez, I seem to be in NZ
Registered: 2010-07-13
Posts: 138
Website

unruly images! Image category gone awol.

I’ve been plugging away on a website for 6 years and suddenly code that has worked 40+ times is no longer doing its thing correctly.

Images in my latest gallery are showing in a semi-random order, despite my efforts.

I created one 55 image gallery a few days ago—works fine. Just as 37 other slide shows work.

The latest 36 image gallery doesn’t. Same code.

Well, it works almost perfectly, it’s just the image order is incorrect.

Using v4.7.1, but I have not changed any settings between the creating these two very similar galleries.

One works perfectly. The last has a slightly bizarre image order.

(I have tried to force it with adding the sort=“asc” as allowed by the plug in but this is not working any differently.)

I do have a large image collection: more than 4800.

So.

Now that the multiple upload plugins are broken I have to upload the images one at a time. Man, oh man.

When I noticed the order was slightly wrong, I re-uploaded the images, again in the correct order. I gave them a different category.

On the website they came out in a different wrong order, the second time around.

Something ain’t right.

This is not an issue with Stef’s plug in. That is working in the other 38 similar slideshows on my site, fine and dandy.

It seems to do with the image category, and the image storing somehow.

Rather than starting on 4834.jpg and ascending as instructed, it starts at the end of the category, 4869.jpg and works backwards until 4846.jpg, then proceeds in the correct order from 4834.jpg!!

The code. (Just to bring back the good old days there for Stef!!)

 <a  class="haast" rel="gallery40” href="/images/4834.jpg">
    <img src="/images/4834.jpg" width="450" height="" title="Click to see slideshow | Haast Paringa Cattle Track, South Westland" alt="Haast Paringa Cattle Track, South Westland" class="slides" /> </a>

    <script type="text/javascript">
    $(".haast").click(function() {   
    $.fancybox.open(  
    <txp:smd_gallery category="haast"  delim="@" paramdelim="|" collate="1" 
    combo='sc_img| { href: "{url}", title: "{caption}" }' >
    [ {sc_img} ],
    </txp:smd_gallery> 
    { padding : 0 
    }); return false;  }); </script>

This creates a slide show that produces:

<script type="text/javascript">
    $(".haast").click(function() {   
    $.fancybox.open(  

    [ { href: "http://www.tramping.net.nz/images/4869.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4868.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4867.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4866.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4865.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4864.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4863.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4862.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4861.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4860.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4859.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4858.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4857.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4856.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4855.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4854.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4853.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4852.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4851.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4850.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4849.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4848.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4847.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4846.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4834.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4835.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4836.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4837.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4838.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4839.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4840.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4841.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4842.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4843.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4844.jpg", title: "" },{ href: "http://www.tramping.net.nz/images/4845.jpg", title: "" } ],

    { padding : 0 
    }); return false;  }); </script>

The slideshow should open on 4834.jpg, not the last image 4869.jpg as it does.

This is the page, and the slideshow is at the bottom. Needs to be looked at on a laptop, pad or big screen, not a phone: Haast Paringa Cattle Track

Any thoughts.

Have I reached some sort of limit at 4800 images?

Last edited by detail (2019-05-17 07:32:34)

Offline

#2 2019-05-17 05:43:05

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,296
Website

Re: unruly images! Image category gone awol.

Did you consider using the sort attribute? Something like

<a  class="haast" rel="gallery40” href="/images/4834.jpg">
    <img src="/images/4834.jpg" width="450" height="" title="Click to see slideshow | Haast Paringa Cattle Track, South Westland" alt="Haast Paringa Cattle Track, South Westland" class="slides" /> </a>

    <script type="text/javascript">
    $(".haast").click(function() {   
    $.fancybox.open(  
    <txp:smd_gallery sort="id" category="haast"  delim="@" paramdelim="|" collate="1" 
    combo='sc_img| { href: "{url}", title: "{caption}" }' >
    [ {sc_img} ],
    </txp:smd_gallery> 
    { padding : 0 
    }); return false;  }); </script>

Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | Respbublika! | NeMe @ github

Offline

#3 2019-05-17 07:30:17

detail
Member
From: geez, I seem to be in NZ
Registered: 2010-07-13
Posts: 138
Website

Re: unruly images! Image category gone awol.

colak wrote #318059:

Did you consider using the sort attribute?

Thanks for taking a look at this.

smd_gallery sorts all images in any category by default by “asc”. Every other slideshow of mine works like that.

But yeah, I tried all sorts of sorting options.

Ain’t sorted yet.

Here’s the thing . . .

For some reason the href="/images/4834.jpg" is starting instead from /4869.jpg. That is the last image.

It then desc for a while, then starts asc. I showed the actual order in the original post copied from the developer info.

Maybe I’ll upload them again and test the slide show one image at a time.

Only 36 images. This will be the third time.

Offline

#4 2019-05-17 08:22:48

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 3,488
Website

Re: unruly images! Image category gone awol.

detail wrote #318058:

Some really wild guesses:

I’ve been plugging away on a website for 6 years and suddenly code that has worked 40+ times is no longer doing its thing correctly.

In the most recent versions of txp, the parser is stricter so code that was not quite right but worked in the past may now fail. But that is a really wild guess.

Now that the multiple upload plugins are broken I have to upload the images one at a time. Man, oh man.

In 4.7 you can actually drag and drop several images from the finder/explorer to the upload box and it will upload them all. I’m not sure if there’s a limit to how many but it’s better than one by one.

Rather than starting on 4834.jpg and ascending as instructed, it starts at the end of the category, 4869.jpg and works backwards until 4846.jpg, then proceeds in the correct order from 4834.jpg!!

It’s weird that it is sorting by descending id and then switching. Could that have something to do with the image dates? You mentioned you used an upload plugin beforehand and perhaps that uploaded images in a certain order but now with your manual upload, the new batch was uploaded in another order.

The docs for smd_gallery says it sorts by category by default. In the docs it then lists name and date before id (I’m not sure if deliberately). That might explain why you’re getting the most recent batch showing up in one order and the next batch in another. But then I would have thought Yiannis’ suggestion of sorting explicitly by sort="id asc" would help?

For some reason the href="/images/4834.jpg" is starting instead from /4869.jpg. That is the last image.

Re: not starting with 4834.jpg, your javascript is overriding your original a href, so it will work from your gallery list not the html code. It probably only used to start with 4834 because that used to be first in the gallery list you have in your javascript.

If you need fancy box to start with a particular title image, there’s a jumpTo method mentioned in the fancybox docs or you could simply add an entry with your desired title image in front of the file list you create with smd_gallery.


TXP Builders – finely-crafted code, design and txp

Offline

#5 2019-05-17 08:32:00

detail
Member
From: geez, I seem to be in NZ
Registered: 2010-07-13
Posts: 138
Website

Re: unruly images! Image category gone awol.

Thanks Jakob

I thought I did exactly the same as I’ve always done.

All my other galleries work just fine. It’s just the 38th!!

I uploaded one gallery earlier in the week that works correctly, and thought it was the same parameters as this errant one.

Anyway, you’ve given me a bit to go on there.

Thanks for your help.

I’ll let you know how it works out.

Offline

#6 2019-05-17 08:39:58

detail
Member
From: geez, I seem to be in NZ
Registered: 2010-07-13
Posts: 138
Website

Re: unruly images! Image category gone awol.

Doh!!

rel="gallery40”

Spot the beginner’s mistake.

Sorry about wasting everyone’s time.

Man, oh man.

All is sweetness and light.

I now can continue on with the rest of my life . . .

Offline

#7 2019-05-17 08:53:14

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,679
Website

Re: unruly images! Image category gone awol.

I was just going to suggest sticking your site in debugging mode for a few moments to see if anything was broken but you beat me to it!

As jakob says, you can upload multiple images now directly in 4.7. Drag/drop/select and it’ll dutifully do your bidding. There’s also a really handy plugin abc_article_image floating around somewhere by Oleg that shows images on the Write panel. Pretty neat: I’ve been using it on a client site recently.

And on another note, the sort attribute usually requires a column name and optional direction. I’m not exactly sure what happens if you just supply a direction but its usage could be determined as ‘undefined’ i.e. ‘at the mercy of the plugin’ so if you want to be sure, always use both a column and a direction in pairs. e.g. sort="name asc, id desc" etc.


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

Txp Builders – finely-crafted code, design and Txp

Offline

#8 2019-05-17 09:10:19

detail
Member
From: geez, I seem to be in NZ
Registered: 2010-07-13
Posts: 138
Website

Re: unruly images! Image category gone awol.

Bloke wrote #318070:

I was just going to suggest

Thanks Stef.

Must be good to see your work in action so usefully six years later. I get about 1000 hits a day for this site in summer. More than 1m now in total.

I’ve used jbx_multiple_image_upload in the past. It worked well, but now past tense. It did 10 at a time.

abl_droploader also worked, but that sounds similar to the now inherent characteristics.

I’ll try it.

I use Adi’s very useful adi_image_tab as my main guide to the images.

Along with adi_page_tab and adi_recent_tab.

Best

Last edited by detail (2019-05-17 09:10:48)

Offline

#9 2019-05-17 10:01:20

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,679
Website

Re: unruly images! Image category gone awol.

detail wrote #318072:

Must be good to see your work in action so usefully six years later.

Yes indeed. It’s a testament to how awesome Textpattern is that the plugin still works with next to no changes after all this time.

That said, and without trying it, I would expect you could pretty much replace the plugin with native tags now. With wraptag and its <+> capability to inject content, the native images tag and its counterparts should be able to construct the JavaScript block with comparative ease.


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

Txp Builders – finely-crafted code, design and Txp

Offline

#10 2019-05-17 11:20:11

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,296
Website

Re: unruly images! Image category gone awol.

Bloke wrote #318076:

Yes indeed. It’s a testament to how awesome Textpattern is that the plugin still works with next to no changes after all this time.

That said, and without trying it, I would expect you could pretty much replace the plugin with native tags now. With wraptag and its <+> capability to inject content, the native images tag and its counterparts should be able to construct the JavaScript block with comparative ease.

And if you use the plagin in the write-tab, the construction of a short-code would make the process very easy.


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | Respbublika! | NeMe @ github

Offline

Board footer

Powered by FluxBB