LycheeOrg / Lychee-v3

A great looking and easy-to-use photo-management-system you can run on your server, to manage and share photos.
https://lycheeorg.github.io/
MIT License
944 stars 95 forks source link

Capture date of photo missing from info sidebar #215

Closed vnorbix closed 5 years ago

vnorbix commented 5 years ago

Detailed description of the problem

After image is imported which has date taken exif info, the Captured date is missing from the sidebar. Instead of the date, false value is shown.

firefox_screenshot_2019-02-21t21-51-59 189z

The database seems to have a correct takestamp in lychee_photos table.

MariaDB [lychee]> select takestamp from lychee_photos
    -> ;
+------------+
| takestamp  |
+------------+
| 1298720653 |
| 1439818560 |
+------------+
2 rows in set (0.001 sec)

Steps to reproduce the issue

Import an image with date taken exif info. Captured value is false on the image info sidebar instead of the date in the image exif.

Output of the diagnostics (Settings => Diagnostics)

Diagnostics
-----------
Warning: Dropbox import not working. No property for dropboxKey.
No critical problems found. Lychee should work without problems!

System Information
------------------
Lychee Version (json):  3.2.13
DB Version:             update_030213
System:                 Linux
PHP Version:            7.2
MySQL Version:          50505
Imagick:                1
Imagick Active:         1
Imagick Version:        1799
GD Version:             bundled (2.1.0 compatible)
Plugins:                

Config Information
------------------
version:                 update_030213
checkForUpdates:         1
sortingPhotos:           ORDER BY id DESC
sortingAlbums:           ORDER BY id DESC
imagick:                 1
lang:                    en
skipDuplicates:          0
layout:                  0
image_overlay:           0
default_license:         none
small_max_width:         0
small_max_height:        360
medium_max_width:        1920
medium_max_height:       1080
deleteImported:          1
image_overlay_type:      takedate
php_script_limit:        0
useExiftool:             0

Browser and system

Linux Mint 19 Tara Firefox for Linux Mint - 1.0 I'm using docker image: linuxserver/lychee

ildyria commented 5 years ago

@vnorbix sorry for coming back to you that late. How did you upload the pictures ? Did you use the web interface or something like lycheesync/lycheeupload ?

vnorbix commented 5 years ago

Just the webinterface in FF, nothing special.

ildyria commented 5 years ago

hummmm very weird.

kamil4 commented 5 years ago

When displaying your photo, can you hit F12 in your browser, switch to the Console tab in the view that opens up, type pprint(photo.json) and send us the output it prints (in particular the cameraDate, sysdate and takedate fields)? Thanks!

vnorbix commented 5 years ago
"  id: \"15511915280306\"
  title: \"SAM_3858\"
  description: \"\"
  tags: \"\"
  public: \"0\"
  star: \"0\"
  album: \"15511911203051\"
  size: \"11 MB\"
  type: \"image/jpeg\"
  width: \"5472\"
  height: \"3648\"
  shutter: \"1/125 s\"
  make: \"SAMSUNG\"
  model: \"NX2000\"
  iso: \"100\"
  aperture: \"f/4.0\"
  focal: \"20 mm\"
  lens: \"\"
  license: \"none\"
  medium: \"uploads/medium/e82df4b20235348cf40592eb87264261.JPG\"
  small: \"uploads/small/e82df4b20235348cf40592eb87264261.JPG\"
  thumbUrl: \"uploads/thumb/e82df4b20235348cf40592eb87264261.jpeg\"
  url: \"uploads/big/e82df4b20235348cf40592eb87264261.JPG\"
  cameraDate: \"1\"
  sysdate: \"26 February 2019\"
  takedate: false
  original_album: \"15511911203051\"
  init: 1"
kamil4 commented 5 years ago

This is mysterious... And this particular photo does have a value in the sysstamp column in the database? What is the actual value in there?

Do you by any chance have some unusual time zone setting on your system? Can you also try running the following in an interactive php session (php -a) and send us the output?

echo setlocale(LC_TIME, 0);
echo date_default_timezone_get();
echo strftime('%d %B %Y - %k:%M', <sysstamp value from the database>);

Although I'm not sure if that could make a difference since Lychee seems to set the timezone to UTC... So do try to run the last line above both before and after doing:

date_default_timezone_set('UTC');
ildyria commented 5 years ago

any news ?

ludomatic commented 5 years ago

Hi,

I have the same problem here on every photo I add within the album, using the "+" and "Upload Photo" or "Import from Server".

Capture d’écran 2019-06-16 à 12 26 00

Here is the content of "lychee_photos" :

MariaDB [lychee]> select * from lychee_photos;
+----------------+----------+-------------+--------------------------------------+------+--------+------------+-------+--------+--------+------+----------+---------------------+-------------+-------------------------+---------+-------+------------+------+---------------------------------------+----------------+------------------------------------------+--------+-------+---------+
| id             | title    | description | url                                  | tags | public | type       | width | height | size   | iso  | aperture | make                | model       | lens                    | shutter | focal | takestamp  | star | thumbUrl                              | album          | checksum                                 | medium | small | license |
+----------------+----------+-------------+--------------------------------------+------+--------+------------+-------+--------+--------+------+----------+---------------------+-------------+-------------------------+---------+-------+------------+------+---------------------------------------+----------------+------------------------------------------+--------+-------+---------+
| 15606460159795 | P6150014 |             | a839a782542da779da18588124222f62.JPG |      |      0 | image/jpeg |  4608 |   3072 | 6.6 MB | 1600 | f/3.8    | OLYMPUS CORPORATION | E-M10MarkII | LEICA DG 12-60/F2.8-4.0 | 1/40 s  | 34 mm | 1560613734 |    0 | a839a782542da779da18588124222f62.jpeg | 15604711498727 | 821a84a7c8913ed36d1846b9d3d433c5b09dfee6 |      1 |     1 | none    |
+----------------+----------+-------------+--------------------------------------+------+--------+------------+-------+--------+--------+------+----------+---------------------+-------------+-------------------------+---------+-------+------------+------+---------------------------------------+----------------+------------------------------------------+--------+-------+---------+
1 row in set (0.001 sec)

And debug :

Diagnostics
-----------
Warning: Dropbox import not working. No property for dropboxKey.
No critical problems found. Lychee should work without problems!

System Information
------------------
Lychee Version (json):  3.2.14
Lychee Version (git):   No git data found. Probably installed from release.
DB Version:             update_030214
System:                 Linux
PHP Version:            7.2
MySQL Version:          50505
Imagick:                1
Imagick Active:         1
Imagick Version:        1800
GD Version:             bundled (2.1.0 compatible)
Plugins:                

Config Information
------------------
checkForUpdates:         1
default_license:         none
deleteImported:          1
full_photo:              1
image_overlay:           1
image_overlay_type:      takedate
imagick:                 1
lang:                    en
layout:                  0
medium_max_height:       1080
medium_max_width:        1920
php_script_limit:        0
skipDuplicates:          0
small_max_height:        360
small_max_width:         0
sortingAlbums:           ORDER BY max_takestamp DESC
sortingPhotos:           ORDER BY takestamp ASC
useExiftool:             1
version:                 update_030214

I have tested useExiftool with 1 and 0, same pb.

pprint(photo.json) :

12:32:48,147 "  id: \"15606460159795\"
  title: \"P6150014\"
  description: \"\"
  tags: \"\"
  public: \"0\"
  star: \"0\"
  album: \"15604711498727\"
  size: \"6.6 MB\"
  type: \"image/jpeg\"
  width: \"4608\"
  height: \"3072\"
  shutter: \"1/40 s\"
  make: \"OLYMPUS CORPORATION\"
  model: \"E-M10MarkII\"
  iso: \"1600\"
  aperture: \"f/3.8\"
  focal: \"34 mm\"
  lens: \"LEICA DG 12-60/F2.8-4.0\"
  license: \"none\"
  medium: \"uploads/medium/a839a782542da779da18588124222f62.JPG\"
  small: \"uploads/small/a839a782542da779da18588124222f62.JPG\"
  thumbUrl: \"uploads/thumb/a839a782542da779da18588124222f62.jpeg\"
  url: \"uploads/big/a839a782542da779da18588124222f62.JPG\"
  cameraDate: \"1\"
  sysdate: \"16 June 2019\"
  takedate: false
  original_album: \"15604711498727\"
  init: 1"

PHP date :

php > echo setlocale(LC_TIME, 0);
C
php > echo date_default_timezone_get();
UTC

@kamil4 : I can't find a sysstamp column, it should be in the lychee_photos table ?

Running Lychee with https://github.com/konstantingoretzki/lychee-docker

kamil4 commented 5 years ago

Sorry, I meant takestamp. Yours looks absolutely normal. Still, could you run on your system:

echo strftime('%d %B %Y - %k:%M', 1560613734);

Because, for a reason I can't explain, when Lychee runs this code on your system, it seems to generate false rather than today's date.

This may be as good a time as any to point out that the development of Lychee v3 is essentially over. We are spending most of our time on Lychee-Laravel, which will soon become Lychee v4. This part of the code is quite different in the new version so hopefully whatever the reason for this misbehavior is, it won't affect the new version. I don't know what the status of container images is for the new version though...

ludomatic commented 5 years ago

That's what I can find at the moment :

php > var_dump(strftime('%d %B %Y - %k:%M', 1560613734));
bool(false)
php > var_dump(strftime('%d %B %Y - %M', 1560613734));
string(17) "15 June 2019 - 48"
php > var_dump(strftime('%k', 1560613734));
bool(false)
php > var_dump(strftime('%d %B %Y - %H:%M', 1560613734));
string(20) "15 June 2019 - 15:48"

After some researches, I finally updated Photo.php (I have v3.2.14) like the fix #256 and everything loaded correctly (date/time in photo overlay and photo description presented in the sidebar). If you want me to make any test further no problem, and thank you for the time you spent on this bug 👍

I was not aware of Lychee v4, I'll have a look, a big ❤️ for all the team behind this project, it's awesome.