Code Monkey home page Code Monkey logo

Comments (42)

tillwf avatar tillwf commented on July 17, 2024 7

Could it simply be sorted by the name as a start ? With current cameras naming convention, the filename reflects the creation date order.

from photos.

tillwf avatar tillwf commented on July 17, 2024 3

@jancborchardt You're right. However, it is not better now, because currently the order is completely random as I transfer my picture using scp. That is why I was saying "as a start". I prefer to have 2 sets of photos ordered than nothing coherent.

from photos.

frieck avatar frieck commented on July 17, 2024 3

Hi @skjnldsv,
For me all photos are being displayed in an incorrect order as they all have been modified sometime.
So changing that line that I mentioned helped me to fix part of the problem, I understand that a File can have a creation date different from the photo that it represents, but that seems to be more uncommon than having a modification date and everything listed by that modification date.

from photos.

jancborchardt avatar jancborchardt commented on July 17, 2024 3

@jancborchardt shall we use creation date by default instead of last modified?

Yep! :)

from photos.

skjnldsv avatar skjnldsv commented on July 17, 2024 2

@frieck this suggest is about the taken date, not the creation date of the file.
So we'd need exif support

from photos.

jancborchardt avatar jancborchardt commented on July 17, 2024 1

Could it simply be sorted by the name as a start ? With current cameras naming convention, the filename reflects the creation date order.

This would break down as soon as you get photos from a second camera or from friends, or the numbering of your own camera wraps โ€“ so the current way is better for now. :)

from photos.

Zaijo avatar Zaijo commented on July 17, 2024 1

Is anyone working on this already? @skjnldsv @jancborchardt Maybe if there's a PR started I could help.

from photos.

skjnldsv avatar skjnldsv commented on July 17, 2024 1

BTW, there's this application gino0631/nextcloud-metadata which can already extract metadata of many formats. Is there a way to use that? @Mikescops @skjnldsv ?

Like mentioned on this thread and others multiple time, this require metadata to be merged and shipper into nextcloud server, available through dav and have a dedicated API for other apps.
Then it would be a few lines of code for the Photos app.

from photos.

Joshua2504 avatar Joshua2504 commented on July 17, 2024 1

Why is this still a thing?

I want to switch to Nextcloud from Google Photos, means I did a full Google Export and uploaded the around 100.000 files to Nextcloud just to figure this out.

When will you change this?

from photos.

skjnldsv avatar skjnldsv commented on July 17, 2024

It would be a nice enhancement.
But we currently do not store the taken date

cc @rullzer

from photos.

skjnldsv avatar skjnldsv commented on July 17, 2024

cc @jancborchardt if it make sense

from photos.

jancborchardt avatar jancborchardt commented on July 17, 2024

Yep, very good point โ€“ for photos it absolutely makes sense to sort by taken date, exactly for the reasons @tillwf mentioned. :)

from photos.

skjnldsv avatar skjnldsv commented on July 17, 2024

I'd rather have modification date (like all mobile galleries work) than name

from photos.

frieck avatar frieck commented on July 17, 2024

Guys, can't we just change this line

'lastmod' => $node->getMTime(),

to use $node->getCreationTime()?
That makes picture be displayed in a more logical order....

from photos.

skjnldsv avatar skjnldsv commented on July 17, 2024

@frieck not arguing with your specific issue :)
It fits some people use, but also not for others. Just reminding that this issue is about the photo taken date, not creation date.

Could the creation date be the default info used ?

Nonetheless, I just notice this line on the main post, which make this confusing ๐Ÿ˜›
@jancborchardt shall we use creation date by default instead of last modified?

from photos.

da-anda avatar da-anda commented on July 17, 2024

creation date of the file is better than the mtime, but EXIF data would ofc be best. Unfortunately, creation date (filesystem level) is also of no use if you use the NC app to sync your pictures from the phone, since all files end up with a creation date of the time of the upload :(

from photos.

jancborchardt avatar jancborchardt commented on July 17, 2024

@skjnldsv considering the amount of discussion and also the pitfalls you mentioned in your comments, this does not seem like a good first issue?

from photos.

skjnldsv avatar skjnldsv commented on July 17, 2024

@skjnldsv considering the amount of discussion and also the pitfalls you mentioned in your comments, this does not seem like a good first issue?

You mentioned created date, which we have. For exif taken date of course this is not a good first issue. :)
There is another issue laying around somewhere that is also similar iirc

from photos.

jcclerval avatar jcclerval commented on July 17, 2024

Hi,
I would also like to sort photos by taken date, rather than last modified date, for the same reason : I have different photos, taken by different devices, covering the same event, and I would like to see them all in chronological order.
I'm new to Nextcloud, and I have a fairly limited experience with php, but I figured I could prototype some temporary function using php built-in EXIF support:

function getOriginalDate($nd) {
	$filename = $nd->getPath();
	$filebase = $nd->getName();
        if ($filebase == "." or $filebase == ".."){
                return 0;
        }
        if (exif_imagetype($filename)) {
                $exif = exif_read_data($filename, 'EXIF');
                if (is_array($exif) || is_object($exif)) {
                        foreach ($exif as $key => $value) {
                                if ($key == 'DateTimeOriginal') {
                                        return strtotime($value);
                                }
                        }
                }
        }
	return $nd->getMTime();
}

and then in photos/lib/Controller/AlbumsController.php:
'lastmod' => getOriginalDate($node)

This way, if the photo has EXIF entries I can use them, otherwise use last modified entry.
But sadly it didn't work.
So I tried to force set all modified date to EXIF taken date if available using EXIF-Tool

for i in *.JPG;
do
echo Traitement de $i
touch -t `exiftool -s -s -s -d "%Y%m%d%H%M.%S" -DateTimeOriginal $i` $i
echo `exiftool -s -s -s -d "%Y:%m:%d %H:%M:%S" -FileModifyDate $i`
echo ""
done
exit 0

But although the code ran, and the files seemed to have been modified, nothing changed when I displayed the album in Nextcloud.

I know the cleanest method would be to handle this server-side but I can't figure out what went wrong with my attempt.
Regards,
J-C

from photos.

frumania avatar frumania commented on July 17, 2024

Hi @skjnldsv,
For me all photos are being displayed in an incorrect order as they all have been modified sometime.
So changing that line that I mentioned helped me to fix part of the problem, I understand that a File can have a creation date different from the photo that it represents, but that seems to be more uncommon than having a modification date and everything listed by that modification date.

Does this require a "rescan" or should it work out of the box?

from photos.

bugsyb avatar bugsyb commented on July 17, 2024

But although the code ran, and the files seemed to have been modified, nothing changed when I displayed the album in Nextcloud.

@jcclerval , belief is that you'd need to run re-scan at least on that folder where photos are.

The best would be to have your approach implemented, meaning:
a) try to extract EXIF picture taken timestamp (normalize to UTC) and display either at presentation layer translated to local one or use timezone as in EXIF,
b) check if file naming convention doesn't reveal YYYY-MM-DD or something similar (trick is to small amount of files is available, i.e. what means 2020-01-01 - for most of Europeans it would be Jan 1st, but not necessarily for everyone),
c) if nothing of above gives good result, use file timestamp (last resort).

This would need to be stored somewhere in a table, probably together with other EXIF related details, like GPS, etc.
This opens nice avenue for presentation layer.

from photos.

jcclerval avatar jcclerval commented on July 17, 2024

Indeed, I ran a re-scan and now it works ๐Ÿ‘ (although it only was the original code with altered last modification date, now I'll try to check the piece of code with non-altered photos)

from photos.

cornzy avatar cornzy commented on July 17, 2024

I think it would be useful to have an option to set cdate of photos to exif DateTimeOriginal and sort photos by cdate. In my opinion, this feature is very important to the photos app as users expect photos to always be sorted by the date they were taken.

from photos.

jancborchardt avatar jancborchardt commented on July 17, 2024

@Zaijo hi, right now no one seems to be working on this โ€“ if you want to dig into the code that would be great! @skjnldsv @Mikescops will be able to help with any questions. :)

from photos.

Zaijo avatar Zaijo commented on July 17, 2024

OK, how can we communicate about this? Do you have a chat or developer forum somewhere? I need help.

from photos.

Zaijo avatar Zaijo commented on July 17, 2024

BTW, there's this application https://github.com/gino0631/nextcloud-metadata which can already extract metadata of many formats. Is there a way to use that? @Mikescops @skjnldsv ?

from photos.

gipadm avatar gipadm commented on July 17, 2024

@Zaijo I am also interested in helping out with this one. Let me know.

from photos.

Zaijo avatar Zaijo commented on July 17, 2024

I'm sorry guys but in between I found Photoprism https://docs.photoprism.org/ which I now use alongside with Nextcloud and this EXIF way for Nextcloud Photos seems to have a veeeery long path before it's usable for me.

from photos.

johannestophoj avatar johannestophoj commented on July 17, 2024

@Zaijo , did you use some guide to install photoprism and set it up with nextcloud? This sync-option looks like it duplicates the image data (?) https://docs.photoprism.org/user-guide/settings/sync/

from photos.

Zaijo avatar Zaijo commented on July 17, 2024

Let's move to e.g. Twitter with that so we don't spam this thread. https://twitter.com/zaj0

from photos.

jcclerval avatar jcclerval commented on July 17, 2024

I reckon it will take some time before it is properly managed server-side. How about some partial temporary feature using PHP built-in EXIF support ? Something similar at what I have written above, but better and at the right place ?

from photos.

skjnldsv avatar skjnldsv commented on July 17, 2024

No, it must be done right or none at all. Temporary hackish features are what got us in lots of trouble in lots of areas. And then no one maintains it, and it suddenly becomes the bottleneck for any desired changes. ๐Ÿ˜–

Locking this thread, nothing more productive seems to be added, you are all free to start working on this and I will help you implement it if you do. ๐Ÿ‘

from photos.

jakobroehrl avatar jakobroehrl commented on July 17, 2024

@marcelklehr
How hard is it to fix this issues when nextcloud/server#30366 will be merged?

from photos.

marcelklehr avatar marcelklehr commented on July 17, 2024

Shouldn't be too hard, IMHO. One problem is that file creation dates are a relatively recent addition to the linux family so may not always be available...

from photos.

jancborchardt avatar jancborchardt commented on July 17, 2024

@artonge what do you think about this one regarding feasibility? Would it need EXIF data to be saved or something else as prerequisite?

from photos.

artonge avatar artonge commented on July 17, 2024

This would need the EXIF data to be saved in the oc_file_metadata table. Easy. But this would also need to be able to order files with on a metadata entry. Harder as there is no logic for that yet. I did not event looked at it, so not even sure that is possible, but I hope it is.

from photos.

jancborchardt avatar jancborchardt commented on July 17, 2024

Whatโ€™s the current state or feasibility regarding this now that we have the data in the metadata table (right?) โ€“ @artonge?

from photos.

szaimen avatar szaimen commented on July 17, 2024

Looks like this would need to be first done by the desktop and other client apps?
See nextcloud/server#30366 (comment)

from photos.

jancborchardt avatar jancborchardt commented on July 17, 2024

cc @tobiasKaminsky also for the client part as mentioned by @szaimen.

from photos.

tobiasKaminsky avatar tobiasKaminsky commented on July 17, 2024

This would need the EXIF data to be saved in the oc_file_metadata table.

This is only on server.
On clients there is no reliable way to check/send creation date.

from photos.

artonge avatar artonge commented on July 17, 2024

Whatโ€™s the current state or feasibility regarding this now that we have the data in the metadata table (right?) โ€“ @artonge?

I do not think that we have the data yet.

from photos.

szaimen avatar szaimen commented on July 17, 2024

So I guess we would need to extract the information on server and store it in the metadata table first?

from photos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.