dreamwidth / dreamwidth

Dreamwidth's open source repository
Other
178 stars 171 forks source link

Sort uploaded images #1976

Open azurelunatic opened 7 years ago

azurelunatic commented 7 years ago

By default the /file/edit has newest images on page 1, oldest on page N.

Requested feature to be able to sort uploaded images in either direction by date. (Optional: what other useful attributes could be sortable? I'm thinking size might be a big one, to help people who have just bumped up against their storage limit.)

pauamma commented 6 years ago

File size is not well-defined. Is it the file size of the full-size version, the sum of file sizes for the full size version and all smaller versions, or ...? (I'm not sure what file size(s) figure into the quota.)

zorkian commented 6 years ago

Hmmm, I would expect quota to only include originally uploaded images -- so the resizes don't count. I would use that value for sorting (the original image's size).

pauamma commented 6 years ago

Actually, it looks like the quota includes all sizes, if I interpret this DW::Media->get_usage_for_user excerpt correctly:

    my ( $usage ) = $u->selectrow_array(
        q{SELECT SUM(mv.filesize) FROM media_versions AS mv, media AS m
          WHERE mv.userid=? AND m.userid=mv.userid AND m.mediaid=mv.mediaid
          AND m.state = 'A'
         },
        undef, $u->id
    );
zorkian commented 6 years ago

Mmm, interesting. That does look like what the code does, but I think the policy makes more sense to only include original sizes? What do you think?

pauamma commented 6 years ago

If you're asking whether only original sizes should count against the quota, I agree, because that's the size the user controls and wants. But that sounds to me like it should be another bug.

If you're asking whether to sort by original size no matter what counts against the quota, I also agree, because it's simpler.