Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Saving Picutures into MySql
QtWS25 Last Chance

Saving Picutures into MySql

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 443 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Dan3460D Offline
    Dan3460D Offline
    Dan3460
    wrote on last edited by
    #1

    I understand that there are conflicting opinions on saving pictures directly in the database but I want to put a picture of an item on a table so the person that is cataloging the data can have a visual reference when selecting the type of item. It will be like having the employee table store the picture of the employee. The main data table will not store the pictures.
    If I have the file either on my disk or a link on the internet, what will be the easiest way to upload the picture to the database.

    Thanks for the help,

    kshegunovK 1 Reply Last reply
    0
    • Dan3460D Dan3460

      I understand that there are conflicting opinions on saving pictures directly in the database but I want to put a picture of an item on a table so the person that is cataloging the data can have a visual reference when selecting the type of item. It will be like having the employee table store the picture of the employee. The main data table will not store the pictures.
      If I have the file either on my disk or a link on the internet, what will be the easiest way to upload the picture to the database.

      Thanks for the help,

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by
      #2

      @Dan3460 said:

      If I have the file either on my disk or a link on the internet, what will be the easiest way to upload the picture to the database.

      Read the whole file as binary, and insert it in the db as you'd do any other field. However, when showing it you'd need to know what type the data is (i.e. jpeg, png etc,) so it's a good idea to keep in the db also the mime type and optionally the size.

      Kind regards.

      Read and abide by the Qt Code of Conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved