Page 1 of 2

Images from server / Fotos desde servidor

Posted: Fri Feb 19, 2021 1:45 am
by Claudio Ricardo
Hola...
Comenzaré un sistema para gestión de inmobiliarias, basado en:
Una PC servidor S.O. Centos con MariaDB local (LAN) o remoto en un Hosting (si
la empresa tiene sucursales), y una copia del programa que voy a hacer en cada
computadora terminal, hasta ahí nada fuera de lo habitual, pero....

Cada propiedad deberá llevar asociadas unas fotos (hasta 10 max.) que, para
ser accesibles desde cualquier terminal, y mostrarse junto a los datos de cada
propiedad, deberán estar guardadas en una o dos carpetas en el servidor...

Mi consulta / pedido de ayuda al foro es:

Hay herramientas en Harbour + HMG que me permitan acceder a esas carpetas
en LAN o Hosting via internet, asi como las hay para MySQL o MariaDB ?
En el server deberé montarlo como FTP o hay otro modo ?
Hay algun ejemplo que me sirva de guía ?

También necesitaría cambiar automáticamente la resolución de las fotos
que guarden, para alivianar la comunicación de la red y el espacio que
ocuparán, además la otra carpeta con thumbnails ayudaría, pero algo así
vi hace poco aqui en este foro y lo pondré en práctica.

Desde yá muy agradecido a todos...

English (Goggle trad)
Hello...
I will start a real estate management system, based on:
A PC server S.O. Centos with MariaDB local (LAN) or remote in a Hosting (if
the company has branches), and a copy of the program that I will do in each
terminal computer, so far nothing out of the ordinary, but ...

Each property must have associated photos (up to 10 max.) That, to
be accessible from any terminal, and be displayed next to the data of each
property, they should be stored in one or two folders on the server ...

My question / request for help to the forum is:

There are tools in Harbor + HMG that allow me to access those folders
in LAN or Hosting via internet, as there are for MySQL or MariaDB?
On the server, should I mount it as FTP or is there another way?
Is there an example to guide me?

You would also need to automatically change the resolution of the photos
that they keep, to alleviate the communication of the network and the space that
will occupy, also the other folder with thumbnails would help, but something like that
I saw here recently in this forum and I will put it into practice.

From now on, very grateful to all ...

Re: Images from server / Fotos desde servidor

Posted: Fri Feb 19, 2021 2:16 am
by andyglezl

Re: Images from server / Fotos desde servidor

Posted: Fri Feb 19, 2021 2:46 am
by Claudio Ricardo
GRACIAS Andy !!!
Yo buscando cómo acceder a carpetas remotas no pensé claro...
Una imagen es un archivo, compuesto por bits... si la decompongo
puedo guardar esos bits en un campo de la DB... en este caso 10 campos
y luego recomponerla para mostrarla en un control image.
Necesitaré reducirlas a unos 100 o 150 Kb. y listo !!
Sólo espero que un par de miles de registros así (más el resto de datos)
no enlentezcan mucho la red o un servicio de internet.

Re: Images from server / Fotos desde servidor

Posted: Fri Feb 19, 2021 2:27 pm
by danielmaximiliano
Hola Claudio: puedes guargarlas en un campo BLOB en tamaño minimo.. debes tener tambien la ruta asociada a esa imagen asi que si quieres verlas en tamaño original cuando hagar click en VER solo descarga esa imagen en tamaño real y no recargas la red.

Re: Images from server / Fotos desde servidor

Posted: Fri Feb 19, 2021 5:08 pm
by Claudio Ricardo
Hola Daniel...
Gracias por tu respuesta, el programa aún no lo inicio, probaré tu sugerencia y posteo el resultado.
Sólo me faltaría una función que reduzca el tamaño de las fotos (seguramente tomadas con celular)
de 3 - 5 Mb. a unos 100 - 150 Kb. Probaré una que postearon aqui hace unos días.

Re: Images from server / Fotos desde servidor

Posted: Fri Feb 19, 2021 6:23 pm
by andyglezl
Hola Claudio, aquí hay algo...
*----------------------------------------------
Hi Claudio, here's something ...


by franco » Wed Jan 20, 2021 6:03 pm

Do you think I could take a 2249 kb jpg and resize to 200 kb and still be clear inside hmg this way to redo my internal camera files before
copying and saving them.
viewtopic.php?f=9&t=6668&start=30

Re: Images from server / Fotos desde servidor

Posted: Fri Feb 19, 2021 9:48 pm
by Claudio Ricardo
Gracias Andy...
La idea es usar la función GetFile () para que el usuario seleccione (desde el Celular / Tablet via USB
o de una carpeta local) y mostrar la foto en una ventana con botones, aceptar / cancelar / cargar otra...
Y la función de Jimmy, que propone Marek en el post que vos me señalás, me viene justa para eso !

Re: Images from server / Fotos desde servidor

Posted: Sat Feb 20, 2021 3:07 pm
by jairpinho
olá Claudio use: HB_Base64EncodeFile ( ) e HB_Base64DecodeFile ( )

BLOBDIRECTEXPORT() Export the contents of a binary large object (BLOB) pointer to a file
BLOBDIRECTGET() Retrieve data stored in a BLOB file without referencing a specific field
BLOBDIRECTIMPORT() Import a file into a BLOB file and return a pointer to the data
BLOBDIRECTPUT() Put data in a BLOB file without referencing a specific field
BLOBEXPORT() Copy the contents of a BLOB, identified by its memo field number, to a file
BLOBGET() Get the contents of a BLOB, identified by its memo field number
BLOBIMPORT() Read the contents of a file as a BLOB, identified by a memo field number
BLOBROOTGET() Retrieve the data from the root area of a BLOB file
BLOBROOTLOCK() Obtain a lock on the root area of a BLOB file
BLOBROOTPUT() Store data in the root area of a BLOB file
BLOBROOTUNLOCK() Release the lock on a BLOB file's root area

https://harbour.github.io/doc/

https://harbour.github.io/doc/clc53.htm ... rectimport

https://harbour.github.io/doc/clc53.html#blobdirectget

https://harbour.github.io/doc/clc53.htm ... rectexport

https://harbour.github.io/doc/clc53.html#blobdirectput

https://harbour.github.io/doc/clc53.html#blobexport

https://harbour.github.io/doc/clc53.html#blobget

https://harbour.github.io/doc/clc53.html#blobimport

Re: Images from server / Fotos desde servidor

Posted: Sat Feb 20, 2021 4:15 pm
by Claudio Ricardo
Gracias Jair...
Pensaba usar estas dos funciones posteadas por Rathinagiri en un
post que me sugirió Andy
viewtopic.php?f=5&t=3167&hilit=thumbnails&start=10

Code: Select all

function file2str( cFileName )
   local oEncoder := TIPEncoderBase64():New()
   local hInput
   local cData := ''
   local cBuffer := Space( 1024 )
   IF hb_FileExists( cFileName )
      hInput := FOpen( cFileName )
      nLen := FRead( hInput, @cBuffer, 1024 )
      DO WHILE nLen > 0
         IF nLen < 1024
            cData += hb_BLeft( cBuffer, nLen )
         ELSE
            cData += cBuffer
         ENDIF
         nLen := FRead( hInput, @cBuffer, 1024 )
      ENDDO
      FClose( hInput )
      cData := oEncoder:Encode( cData )
      return cData
   ENDIF
return cData
//---------------------------------------------------------------------------
function str2file( cStr, cFileName )
   local oEncoder := TIPEncoderBase64():New()
   local hOutput
   cStr := oEncoder:Decode( cStr )
   hOutput := FCreate( cFileName )
   FWrite( hOutput, cStr )
   FClose( hOutput )
return nil
Estudiaré detenidamente las funciones que me propones (también Daniel las sugirió)
y veré cuál se adapta mejor a lo que necesito.

Nuevamente, Muchas Gracias a todos por la ayuda prestada.

Re: Images from server / Fotos desde servidor

Posted: Sun Feb 21, 2021 6:31 pm
by franco
Here`s my thought.
Thanks to
Andres, Jimmy an Mol
With this demo you can size jpg files from 3MB to 54KB or more depending on what you need.