Home Forums Persistence Data Sources Retrieve profile picture into actual format(JPEG/PNG/..)

Viewing 1 reply thread
  • Author
    Posts
    • #10374
      srinivas suddalasrinivas suddala
      Participant

      Hi,

      I observed that the image is getting saved into NJObject & NJEntityImageThumb tables in binary format when we set a picture to a contact,  but I am not able to get the image back into actual format when i copy and paste the binary data in online conversion tools.

      Please let me know the exact format of binary data saving into table and also what are the different and easiest ways to get the image back in to actual format using external tools.

       

      Thanking you…

      Srinivas

      0
    • #10395
      Clayton ChowClayton Chow
      Participant

      Hi Srinivas,

      I can’t recommend a specific third party tool – however you are correct in stating that the the ‘obj’ in NJobject is a direct binary representation of the image file selected for a Contact in the application; there is no additional formatting of the file done.

      I can’t speak specifically why the online tool did not work; but ‘copy and pasting’ from SQL Server is problematic as their UI displays it as a hexadecimal representation of the binary data and the online tool may not be converting that.

      A more reliable extract method would be to use the native OLE Automation stored procedures in SQL Server to extract the binary data to a physical file.  The extension of the file can then be found out by a MIME Type verifier: some psuedo code below.

      On a side note: accessing the database/ ad-hocly should be safe, but any consistent processes that access the db would run into contention with the NexJ app (e.g. row locking, invalid caches)

      EXEC sp_OACreate ‘ADODB.Stream’, @temp OUTPUT;
      EXEC sp_OAMethod @temp, ‘Open’;
      EXEC sp_OAMethod @temp, ‘Write’, NULL, @data;
      EXEC sp_OAMethod @temp, ‘SaveToFile’, NULL, @filePath, 2;
      EXEC sp_OAMethod @temp, ‘Close’;

      0
Viewing 1 reply thread
  • You must be logged in to reply to this topic.