Capture the URL path of image upload

2 posts by 2 authors in: Forums > CMS Builder
Last Post: April 4, 2018   (RSS)

By Mikey - March 28, 2018

I have a multi section editor called "video" created for uploading a mp4, wmd, ogg videos. In this section editor I also have a field for uploading a video poster image. I know I can use the code generator to get the foreach loop to load the video poster... but that will not work for this particular scenario.

So, I need to create a method that when a video poster image is uploaded and the record is saved, the URL path to the image is added into a text field call "video_poster_url" -OR- a method to find the uploaded video poster and connect it to the videos by matching up the section editor and upload by the nums.

I was thinking about building an add-on to do this, but haven't a clue where to begin to build such an add-on to capture the image URL path. Anyone have any suggestions on where to start?

Thanks, Zicky

By leo - April 4, 2018

Hi Zicky,

If your video records contain an upload field for video files and another upload field for the poster, the uploads should be linked to the video record already by default. To get the uploads you can either use getRecords() function with 'loadUploads' to be true, or just callĀ getUploads($tableName, $fieldName, $recordNum). And the urlĀ path of the uploads will be the value of 'urlPath' key in the relative upload data.

Hope this answers your question.

Thanks,

Leo - PHP Programmer (in training)
interactivetools.com