CB Gallery question

11 months 1 week ago #333876 by activha
CB Gallery question was created by activha
Hi 

I was thinking at using CB Gallery plugin to allow users to upload files (pdfs and text) and at writing an autoaction to automatically parse pdf files and convert them to text files.

I have a few questions before trying :

- do you have triggers allowing to act on uploaded files with selected extensions ?
- is there a pdf parser library within CB ?
- if I succeed in converting a file, how could I link the txt version to the pdf one so that removing the pdf would delete the txt version ?

Thanks for your ideas 

Please Log in to join the conversation.

11 months 1 week ago #333881 by krileon
Replied by krileon on topic CB Gallery question

- do you have triggers allowing to act on uploaded files with selected extensions ?

If you intend on just acting on the upload after it has already processed then you'd use gallery_onAfterCreateItem for new uploads. It only contains a single variable the ItemTable object which is the PHP entity for its _comprofiler_plugin_gallery_items row.

- is there a pdf parser library within CB ?

No

- if I succeed in converting a file, how could I link the txt version to the pdf one so that removing the pdf would delete the txt version ?

I suppose if you managed to get this working you'd act on gallery_onAfterDeleteItem (same as above regarding its variable) and delete the text file when the pdf is deleted. I can't imagine why you'd need to convert the pdf to text though.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

11 months 1 week ago #333882 by activha
Replied by activha on topic CB Gallery question
I want our business users to have private spaces where they will upload and manage txt files, images and pdfs.
Then I will convert the pdfs to texts to be able to make embeddings with OpenAI API and convert them to vectors stored in PineCone.
After that I'd use this to better context the answers given to external users using our new web component linked to Chat API. See a demo on jardinsdurhone.fr (MoniA icon)

Being able to use CB, CBSubs and autoaction is perfect as we can manage all the subscribed users data easily.

I thought that using gallery would allow a simple management of their files for this purpose

Please Log in to join the conversation.

11 months 1 week ago - 11 months 23 hours ago #333884 by krileon
Replied by krileon on topic CB Gallery question
It should be doable then. Both those triggers give you access to the information you should need. On gallery_onAfterCreateItem is when you'd handle generating a txt file from the pdf. You'll probably need to take a look at the ItemTable class below though as several of its functions will probably be needed.

/components/com_comprofiler/plugin/user/plug_cbgallery/library/Table/ItemTable.php

Example as follows.

PHP
File Path: $variables['var1']->path()
File Exists: $variables['var1']->exists()
File Date: $variables['var1']->modified()
File Size: $variables['var1']->size()
File Extension: $variables['var1']->extension()

Format Function
File Path: [cb:parse function="path" class="var1" /]
File Exists: [cb:parse function="exists" class="var1" /]
File Date: [cb:parse function="modified" class="var1" /]
File Size: [cb:parse function="size" class="var1" /]
File Extension: [cb:parse function="extension" class="var1" /]


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

11 months 23 hours ago #333954 by activha
Replied by activha on topic CB Gallery question
Thanks.

A few questions :
how can I get the confidentiality status of the document ?
how can I get the id ? I guess it's better to use than the name to allow deletion of the stored vectors if the document is suppressed
if it's a youtube link, where is it stored and how can I send the url to my other application ?
Same question if it's a website url for instance ?

Please Log in to join the conversation.

11 months 23 hours ago #333959 by krileon
Replied by krileon on topic CB Gallery question

how can I get the confidentiality status of the document ?

You'll need to process the PDF. We don't check any of that in CB Gallery.

how can I get the id ?

[var1_id]

I guess it's better to use than the name to allow deletion of the stored vectors if the document is suppressed
if it's a youtube link, where is it stored and how can I send the url to my other application ?
Same question if it's a website url for instance ?

It will have a domain if it's a link. Use the below to get the domain. If empty string then it's not a linked media.

PHP
$variables['var1']->domain()

Format Function
[cb:parse function="domain" class="var1" /]


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.201 seconds

Facebook Twitter LinkedIn