MediaSet in temporary records

viljarpviljarp Member Posts: 3
Hi! I'm building an image gallery page. The pictures should not be stored to the database but to the server folder. I am able to implement this by importing the file to the temporary table Media or MediaSet field Rec."Picture Media".ImportFile(FilePath, '');

I notice that each time when creating the temporary records, the Tenant Media records are created. I guess, that will consume a lot of space in database. In cloud version the media records are not included to the database size but in OnPrem they are.

I wonder if I could use the existing Tenant Media record on my temporary record instead of importing the file each time and creating new Tenant Media record. Tenant Media record holds a file name, there is no problem to find that. If I could find the corresponding Tenant Media Set record, I could copy the "Media ID" (type Media) to the temporary record field. However, I don't find a way to get the correct Tenant Media Set record.

Two questions...
1) how to find an existing Tenant Media Set record using the file name?
2) how could I clean the Tenant Media records? Do I need to delete the records myself, is the field "Expiration Date" that does it for me or some other way?

Viljar

Answers

  • JuhlJuhl Member Posts: 724
    Use Blob on page or in temp table.
    Dont use Media for this scenario.
    Follow me on my blog juhl.blog
  • viljarpviljarp Member Posts: 3
    thank you Juhl for this answer. For picture gallery the blob is not a good option... Then I should use a card page instead of list in order to get the picture shown in a good size. I think I found a solution by using the Expiration Date for Tenant Media records (setting the Expiration Date after file import) and deleting them with a job queue later.
Sign In or Register to comment.