Hello, I would like to automate using a PHP function to insert a picture stored in SC (project) into a table field (longblob, Image (Database)). I already tried different things with sc_exec_sql with LOAD_FILE (pathtofile), unfortunately without success. Can anyone tell me how this works?
$sql_command = "SELECT my_imgen from my_table WHERE code = ".{CODE};
sc_lookup(my_data, $sql_command);
[my_icono] = ‘<img src="data:image/jpeg;base64,’ . base64_encode( {my_data[0][0]} ) . ‘" width=“65” height=“65” />’;
Thanks for the answer, I will test it. What about copying pictures (databased) from table to table?
$sql_command = “SELECT CompanyLogo from InstallerProfiles WHERE InstallerProfileID = 1”;
sc_lookup(my_data, $sql_command);
[my_icono] = ‘<img src="data:image/jpeg;base64,’ . base64_encode( {my_data[0][0]} ) . ‘" width=“65” height=“65” />’;
Result the Variable [my_icono not exist]
OK, i want to realize this in a form with php methode.
I need 2 PHP Methods in a Form
1 Copy a picture stored on host to a table field is Image(Database).
2. Copy a picture from table to table fields are Image(Database)
In the form i nieed that the user can select an excel Table to import Data in a Database Table
ok, i will ask in a other way. I have a stored file anywhere on the host e.g. /tmp/pic.png, and now i will copy this file to a table/field (Image(Database). I need this automate when OneAfterInsert in the form. How can i do this?
If your database is MySQL, then
If Host and MySQL is on the same server, you may want to MySQL itself to import the data. (https://dev.mysql.com/doc/refman/8.0/en/load-data.html)
I think MySQL may be able to Load Data from remote server/location, but I have never tried that.