File upload set media library as source

Is i possible to have the media library as a source for the file upload widget? My client uses many of the same images, and would like to choose them from the media library not his computer anytime he ads a new (in his case) tour (travel website).

Hi, answer is no is not possible. File upload, only upload a file or image and attach them.

Why you need join this two things?

My client uses the same images across different types of content. Some of them are in galleries and some as covers hence different sizes, sometimes different alt descriptions. And heā€™d like to have them in one location easy to select them from - media library is a good option for him.

I recently created a hybrid between mediafinder and fileupload for my client.

Data is stored similarly to mediafinder but in JSON.

It might help you?

1 Like

Hi, There is MediaFinder widget in octobercms Media Finder Field - October CMS - 3.x. why you are not using this? may be if you can explain further. In media finder you can use the same image multiple time. Well the alt text might be an issue but other issue can be solved like this.

1 Like

is it possible to have it as a plugin?

Yes, Iā€™ve created like a new formwidget called mediagallery that Iā€™d like to share with the community. But I have a lot of work to do now, maybe next week.

2 Likes

Thanks. looking forward to it.

question is, why exactly you are not using mediafinder?

cover:
   type: mediafinder
   mode: image
   maxItems: 1

gallery:
   type: mediafinder
   mode: image

first gallery on this screen is ā€œfileuploadā€, second is ā€œmediafinderā€.
difference is, that first is requesting upload, second opens mediafinder

metadata

Regarding to metadata information, check out mine plugin SNiPI.MEMetadata
this will allow you to update and create metadata for images
it creates this little ā€œpenā€ icon and opens metadata editor

like this

and how to correctly shows pic with correct metadata is on ā€œAbout sectionā€
image

response from |metadata is like this

{
"title":"185953142_max.jpg",
"keywords":"keywords, keyword",
"filepath":"\/clanky\/185953142_max.jpg",
"description":"Nobody knows",
"source":"RPIshop.cz",
"source_url":"",
"author":"RPI",
"author_url":""
}

then when you use {% set metadata = 'source/to/file'|metadata %} you can access

{{ metadata.title }} by <a href="{{ metadata.author_url }}">{{ metadata.author }}</a>

Hope it helps

2 Likes

As far as i know the mediafinder stores the path to the image, and the fileupload. The upside form the mediafinder is the ease of manipulating the image on the template files (changing dimensions, extensions etc).

For changing dimensions you can use the |resize filter. It will work on any image path regardless if it is mediaFinder or mediaUpload.

I get it, but still nothing beats the ease of attaching files as a relation to a model :slight_smile:

this is lil bit missleading, because, imagine, that you use mediafinder as attachment, right? and in some point on time, you remove something, then what? in attachment, probably file will be deleted, right? on mediafinder as attachment, what relation exactly you think, is needed to reflect each one content type, where you will use it?

fileupload is - from naming - for uploading, then creating fixed relation between model and file.
mediafinder - from naming - find and use media as is. that simple

On RainLab.Pages etc, in editor, you can pick if you wish to use file upload or mediafinder, when you wish to insert image in content. probably, best way for you is, to create specific formwidget with two buttons, upload or pick file.

when upload, fileuploader will be triggered, when pick, mediafinder will be triggered. but, still, questionable is how to reffer this kind of morphing. probably strategy based, butā€¦ who knows.

I donā€™t see any difference or difficulties here why one is preferred over the other. Both have thier own merits. Offcourse if you want your DB tables to be small then yes Relation is good option. but mediaFinder is also good in many use cases where you dont need to repeaditly upload the same image.

Thatā€™s what iā€™d figured but hoped someone had the same problem before :wink: And the idea was to create a new attachment (can be duplicated) from the media finder, so it just acts as a source but the core functionality of the fileupload widget would stay the same.

but mediaFinder is also good in many use cases where you dont need to repeaditly upload the same image.

Yes that was my idea - to use the media finder as a source for file upload - all the rest of its functionality would stay the same (the files is copied etc).