Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2005-09-11 20:57:39

1beb
Plugin Author
From: Canada, Ontario, Toronto
Registered: 2004-11-22
Posts: 169
Website

Hack: Admin Image - Sorting Options

<img src=“http://www.bertelsen.ca/images/291.jpg” alt=“Yay for being able to sort!” />

A direct hack that allows you to sort the images using header links like every other page in the textpattern admin area. By Id, Name, Category and Author.

Directions for Use

Download the Source

Textpattern 4.0 : txp_image-4.0

Textpattern 4.0.1 : txp_image-4.0.1

Textpattern 4.0.2 : txp_image-4.0.2

Textpattern 4.0.3 : txp_image-4.0.3 (Thanks Matthias )

Rename the file that corresponds to your distribution to txp_image.php and upload to your server in:

your_txp_install_folder/include/

Voila

For directions on implementing the changes by hand please visit the link below:

LINK

Last edited by 1beb (2006-04-03 07:00:05)

Offline

#2 2005-09-13 10:59:30

cnolle
Archived Plugin Author
Registered: 2004-03-21
Posts: 87
Website

Re: Hack: Admin Image - Sorting Options

This is really useful, but its not a plugin which would be somewhat problematic if you update textpattern via SVN. Perhaps you can submit it as a patch and it might be included in source?

Offline

#3 2005-09-13 17:03:21

1beb
Plugin Author
From: Canada, Ontario, Toronto
Registered: 2004-11-22
Posts: 169
Website

Re: Hack: Admin Image - Sorting Options

I looked at all the subversion mumbojumbo, and came to the conclusion that it’s just too techy for me ( read: I don’t have time to figure all of that out right now) I’m sure they read the forums, hence, if the devs want the hack it’s already available through the above text files… if it get’s used. Cool. If not… well, I made it for me anyways ;)

Last edited by 1beb (2005-09-14 04:15:40)

Offline

#4 2005-11-27 14:30:38

andrea
Member
From: la la land
Registered: 2004-02-24
Posts: 62
Website

Re: Hack: Admin Image - Sorting Options

the one thing i can’t stand about textpattern is the lack of image support in the admin, it’s just wayyy unwieldy if you have more than a page or two of pictures. anyhow, this hack is definitely a step in the right direction, thanks.

however, it doesn’t seem to be working for me – the default of having it list images by id is fine, but when i click on name, to sort that way, nothing happens. same with category, author, etc.

Last edited by andrea (2005-11-27 14:36:15)

Offline

#5 2005-11-28 05:47:08

1beb
Plugin Author
From: Canada, Ontario, Toronto
Registered: 2004-11-22
Posts: 169
Website

Re: Hack: Admin Image - Sorting Options

What version of Txp are you using? I’ve just updated the above for 4.0.2… Over the holidays I think I’m going to add in the ability to list by category, clicking on the category drops all the appropriate info, removing the pagination and simplifying things a bit. Should be a bitch, but it’ll be a great “keep me busy project” over the holidays ;)

Last edited by 1beb (2005-11-28 07:13:12)

Offline

#6 2005-11-28 21:14:19

TheEric
Plugin Author
From: Colorado & Montana.
Registered: 2004-09-17
Posts: 573
Website

Re: Hack: Admin Image - Sorting Options

> andrea wrote:

> the one thing i can’t stand about textpattern is the lack of image support in the admin,
>it’s just wayyy unwieldy if you have more than a page or two
> of pictures. anyhow, this hack is definitely a step in the right direction, thanks.

Agreed. Same here – I’ve been working on a gallery like setup for TXP, but have found myself frequently frustrated with it’s almost complete lack of support for images on the admin side. My current plugin (which can be seen here in a seriously pre-alpha version .000001 stage) has been hampered by the need to create upteen million admin side tweaks.

Txp is a great piece of weblog software… It’s just got a lot of work needed for a competent photolog system.

Offline

#7 2005-11-28 21:17:56

1beb
Plugin Author
From: Canada, Ontario, Toronto
Registered: 2004-11-22
Posts: 169
Website

Re: Hack: Admin Image - Sorting Options

I think there are already a few decent gallery systems available for txp, no need to re-invent the wheel, just hack on the ones that are already there!

Offline

#8 2005-11-28 21:25:03

TheEric
Plugin Author
From: Colorado & Montana.
Registered: 2004-09-17
Posts: 573
Website

Re: Hack: Admin Image - Sorting Options

Nah. None around that fit my needs. I wanted the classic album list / thumbnail / larger image + exif info + comment system. Everything else was close but would require a rewrite to do what I wanted it to do. Albumpattern came closest, but I didn’t like the way it created three new table fields when all that was needed was one.

So, I’m writing my own.

Last edited by TheEric (2005-11-28 21:28:32)

Offline

#9 2005-12-09 21:14:46

andrea
Member
From: la la land
Registered: 2004-02-24
Posts: 62
Website

Re: Hack: Admin Image - Sorting Options

hmm, when i tried with the latest version, i got this:

Warning: Division by zero in /users/home/xxx/public_html/textpattern/include/txp_image.php on line 80

i totally want to be able to use this – and the idea of being able to sort by categories, yay.

Offline

#10 2005-12-11 17:37:21

jdykast
Member
From: Tennessee
Registered: 2004-12-30
Posts: 119
Website

Re: Hack: Admin Image - Sorting Options

I ran into the same divide by zero problem. I’m using TXP 4.0.2 and I had installed the file that was supposed to be for this version. You can fix the problem by replacing the following:

<code>$total = getCount(‘txp_image’,“1”);
$limit = $image_list_pageby;
if(!$limit){$limit=1;}
if($limit=0){$limit=1;}
$numPages = ceil($total/$limit);
$page = (!$page) ? 1 : $page;
$offset = ($page – 1) * $limit;
</code>

With the original code from the 4.0.2 distribution:

<code>$total = getCount(‘txp_image’,“1=1”);
$limit = max(@$image_list_pageby, 25);
$numPages = ceil($total/$limit);
$page = (!$page) ? 1 : $page;
$offset = ($page – 1) * $limit;
</code>

This made things work for me. By the way, I love this hack – I’ve been wanting something like this myself.

Last edited by jdykast (2005-12-11 17:38:18)

Offline

#11 2006-03-30 08:48:22

The-Exit
Member
From: Berlin
Registered: 2005-07-16
Posts: 175
Website

Re: Hack: Admin Image - Sorting Options

Well, I will have a look to get this working for 4.0.3 tonight or the weekend.

But I think, it would be just lovely to have it as a patch.

Offline

#12 2006-03-30 14:38:15

1beb
Plugin Author
From: Canada, Ontario, Toronto
Registered: 2004-11-22
Posts: 169
Website

Re: Hack: Admin Image - Sorting Options

It’s been reported that there are no known issues with 4.0.3. Regarding a submission as a patch, I don’t understand Subversion, and I don’t have time now to figure it out. Exams exams exams!

Offline

Board footer

Powered by FluxBB