I used lycheesync to import a large amount of photos into my server, however for some of them the import failed with an error:
1406 Data too long for row
When I took a closer look I found that focal of the exif information is to large for the mysql database. In my case focal is 16.799999237060547 mm, which is longer than 20 Byte!
mysql> describe lychee_photos;
+-------------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+---------------------+------+-----+---------+-------+
| id | bigint(14) unsigned | NO | PRI | NULL | |
| title | varchar(100) | NO | | | |
| description | varchar(1000) | YES | | | |
| url | varchar(100) | NO | | NULL | |
| tags | varchar(1000) | NO | | | |
| public | tinyint(1) | NO | | NULL | |
| type | varchar(10) | NO | | NULL | |
| width | int(11) | NO | | NULL | |
| height | int(11) | NO | | NULL | |
| size | varchar(20) | NO | | NULL | |
| iso | varchar(15) | NO | | NULL | |
| aperture | varchar(20) | NO | | NULL | |
| make | varchar(50) | NO | | NULL | |
| model | varchar(50) | NO | | NULL | |
| shutter | varchar(30) | NO | | NULL | |
| focal | varchar(20) | NO | | NULL | |
| takestamp | int(11) | YES | | NULL | |
| star | tinyint(1) | NO | MUL | NULL | |
| thumbUrl | char(37) | NO | | NULL | |
| album | bigint(14) unsigned | NO | MUL | NULL | |
| checksum | char(40) | YES | | NULL | |
| medium | tinyint(1) | NO | | 0 | |
+-------------+---------------------+------+-----+---------+-------+
I changed the code as follows and everything is working for now:
I used lycheesync to import a large amount of photos into my server, however for some of them the import failed with an error:
When I took a closer look I found that
focal
of theexif
information is to large for the mysql database. In my casefocal
is16.799999237060547 mm
, which is longer than 20 Byte!I changed the code as follows and everything is working for now:
Is it ok to perform the checks at this location or would you recommed something else?