fred4jupiter / fredbet

Simple football betting application using Spring Boot, Thymeleaf and Bootstrap. Well prepared for betting with friends.
MIT License
119 stars 63 forks source link

Error while uploading images or changing profile image #49

Closed jt0in3e closed 1 week ago

jt0in3e commented 2 weeks ago

I would like to report a little annoying but not critical issue. Everything works as expected except images won't upload. the following error is produced while uploading pics:

Cause: org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute statement [(conn=93) Data too long for column 'image_bytes' at row 1] [insert into image_binary (image_bytes,image_group_id,thumb_image_bytes,version,image_key) values (?,?,?,?,?)]; SQL [insert into image_binary (image_bytes,image_group_id,thumb_image_bytes,version,image_key) values (?,?,?,?,?)]

The app is installed with docker-compose on VPS with mariadb configs as in example file.

docker-compose.yml

```yml services: mariadb: image: mariadb volumes: - "./mariadb:/var/lib/mysql" environment: - MYSQL_DATABASE=mybd - MYSQL_ROOT_PASSWORD=secred - MYSQL_USER=yes - MYSQL_PASSWORD=yes fredbet: image: fred4jupiter/fredbet:latest depends_on: - mariadb ports: - "8080:8080" environment: - SPRING_PROFILES_ACTIVE=maria - SPRING_DATASOURCE_URL=jdbc:mariadb://mariadb:3306/fredbetdb - SPRING_DATASOURCE_USERNAME=yes - SPRING_DATASOURCE_PASSWORD=yes - SPRING_DATASOURCE_DRIVER_CLASS_NAME=org.mariadb.jdbc.Driver - FREDBET_DEFAULT_LANGUAGE=en ```

what could be a reason for that?

fred4jupiter commented 2 weeks ago

It seems that the uploaded image is to large for the database column type. You can try to change the database type to LONGBLOB or upload a smaller image

fred4jupiter commented 2 weeks ago

I´ve just pushed a bugfix for the wrong column type in mariadb and mysql. With version 10.1 of mariadb it was working. With version 11 of mariadb the column type for storing the image binaries has to be of type LONGBLOB. The liquibase change file will update the column type automatically. Please change if the docker image with "latest" tag is working for you now.

fred4jupiter commented 1 week ago

fixed with version 3.3.2