Jump to content

Media Manager


kongondo

Recommended Posts

Hello @kongondo,

I have  added a checkbox field to the media-manager-image template but cannot choose it as a custom column.

Guess this matter is about supported field types for custom columns. Fieldtype Checkbox seems not to be supported. It is supported in normal listers, though. Would it be possible to add support?

And is there a list of the supported field types?

EDIT: If I add the field id manually to the MM settings JSON, the column appears in the image lister, but not in the Settings ASM Select

  • Like 1
Link to comment
Share on other sites

Hi @gebeer,

10 hours ago, gebeer said:

Guess this matter is about supported field types for custom columns. Fieldtype Checkbox seems not to be supported. It is supported in normal listers, though. Would it be possible to add support?

I cannot remember why I don't support it. I think it is just an oversight on my part. I will add this in the future. 

 

10 hours ago, gebeer said:

And is there a list of the supported field types?

I used to have one in the docs but I cannot find that page now. I must have deleted it by mistake! Sorry. 

10 hours ago, gebeer said:

EDIT: If I add the field id manually to the MM settings JSON, the column appears in the image lister, but not in the Settings ASM Select

Better to add 'FieldtypeCheckbox' in the array in 'MediaManagerUtilities.php' around line #1814 (in the method allowedFieldTypes()). This is where I'll add it in a future release.

  • Like 1
Link to comment
Share on other sites

9 hours ago, kongondo said:

Better to add 'FieldtypeCheckbox' in the array in 'MediaManagerUtilities.php' around line #1814 (in the method allowedFieldTypes()). This is where I'll add it in a future release.

This is working great. Thank you.

Actually I had added it to the JSON before inside a migration method for MM settings. Since MM stores it's settings not as ModuleConfigData but as custom JSON, I had to come up with a method in our migration class that keeps the settings in sync between dev and live. Just in case anybody needs this, here is what I did:

	/**
	 * apply settings to MediaManager
	 */
	private function applyMediaManagerSettings()
	{
		$path = $this->wire('config')->urls->admin . 'media-manager/';
		$selector = "template=media-manager-settings, status<" . Page::statusTrash;
		if (!$this->wire('modules')->isInstalled('PagePaths')) $selector .= ", parent={$path}";
		$settingsPage = $this->wire('pages')->get($selector);
		$settingsRaw = $settingsPage->media_manager_settings;
		$settings = wireDecodeJSON($settingsRaw);

		//allowed media types
		$settings['allowed_media'] = ['media' => [/* "audio",  */"document","image","video"]];
		// Add uploads to media library and publish them
		$settings['after'][0] = 1;
		// show filter profiles: yes
		$settings['show_filter_profiles'] = [1];
		// Display User Media: Display all Media
		$settings['user_media_only'] = [1];
		// Sort Media By: Created
		$settings['sort_media'] = [4];
		// Sort Media Order: Descending
		$settings['sort_media_order'] = [2];
		// custom columns in Media manager
		$imageFields = [];
		foreach (['products', 'clinical_applications', 'technologies', 'image_gallery'] as $field) $imageFields[] = $this->wire->fields->get($field)->id;
		$settings['custom_columns'] = array('image' => $imageFields);
		// filter profiles
		$settings['filters'] = [
			"filter-by-tags" => ["defaultSelector" => "title%=, media_manager_image.tags~=, media_manager_document.tags~=, media_manager_video.tags~=", "title" => "Filter by Tags"],
		];

		// save settings
		$settingsPage->of(false);
		$settingsPage->media_manager_settings = wireEncodeJSON($settings);
		$settingsPage->save();
	}

 

  • Like 1
Link to comment
Share on other sites

  • 1 month later...
On 11/30/2022 at 6:56 PM, gebeer said:

@kongondoIn my install (PW 3.0.200), Media Manager pages for images and documents get saved under Admin->Media Manager->Media Manager:Audio instead of Media Manager:Image and Media Manager:Document. They have the correct template media-manager-image and media-manager-document, but are under the wrong parent.

What could be the reason?

Hi, bringing this up again because I found the reason. On install of MM, the children under Admin->MediaManager got named "media-manager--image", --audio etc. No idea how this happended, though. Guess I will rename them manually. Since on upload the parent is defined by those page names, no parent is defined and all media gets saved under Media Manage:Audio.
A check in MediaManagerActions.php around  L1575  for $parent instancof NullPage or the like would be great to at least issue a warning.
Consequently the checks for duplicates on upload did not work. This is how I discovered the root cause.    

  • Like 1
Link to comment
Share on other sites

On 2/15/2023 at 4:55 PM, gebeer said:

Hi, bringing this up again because I found the reason. On install of MM, the children under Admin->MediaManager got named "media-manager--image", --audio etc. No idea how this happended, though. Guess I will rename them manually. Since on upload the parent is defined by those page names, no parent is defined and all media gets saved under Media Manage:Audio.
A check in MediaManagerActions.php around  L1575  for $parent instancof NullPage or the like would be great to at least issue a warning.
Consequently the checks for duplicates on upload did not work. This is how I discovered the root cause.    

Just to recap in case anyone else experienced this: After MM install I ended up with pages with wrong names (media-manager--audio, --document, --image, --video) under Admin->Media Manager. As a consequence all created media pages got saved under parent Admin->Media Manager->Media Manager:Audio. This also had an impact on duplicate media pages. They could not be detected. So no matter what the settings for duplicate media, all media got uploaded even if it was duplicates.

I used this code to rename pages under Admin->Media Manager to have correct names like (media-manager-audio, -document, -image, -video) and move all media pages to live under their correct parent pages:

		// FIX wrong Media Manager page names under Admin -> Media Manager and sort media pages under correct parent
		$types = ['audio', 'document', 'image', 'video'];
		// fix page names from "media-manager--$type" to "media-manager-$type"
		foreach($types as $type) {
			$pID = $this->wire->pages->getId("parent.name=media-manager, name=media-manager--{$type}");
			if($pID) {
				$this->wire->pages->get($pID)->setAndSave('name', "media-manager-{$type}");
			}
		}
		// move media pages from wrong parent media-manager-audio to correct parent "media-manager-$type"
		foreach($types as $type) {
			// get all media pages under media-manager-audio parent
			$ids = $this->wire->pages->findIDs("parent.name=media-manager-audio, media_manager_{$type}!=");
			// put them under correct parent
			if(count($ids)) {
				$parentID = $this->wire->pages->getID("parent.name=media-manager, name=media-manager-{$type}");
				if($parentID) {
					foreach($ids as $id) {
						$p = $this->wire->pages->get($id);
						$p->setAndSave('parent', $parentID);
					}
				}
			}
		}

 

  • Like 1
Link to comment
Share on other sites

@kongondo Where are messages from MM actions like uploads etc are supposed to appear in the GUI? I mean messages that are generated during executeAjax(). I can see them as JSON response in the dev tools for requests to e.g. /processwire/media-manager/ajax/ like

{
	"files": [
		{
			"name": "csm_us_ziehmvisionrfdhybridedition-usa-forweb_1080x1080px_7c9dea3ab6.jpg",
			"size": 34682
		}
	],
	"count_total": 1,
	"count_success": 1,
	"count_fail": 0,
	"message": "error",
	"notice": "Media Manager: No valid media found to add to Media Library. If replacing media, check that they are not locked.",
	"nothingAddedYet": "Nothing added yet.",
	"action": "upload",
	"currentPageID": 0,
	"mediaManagerFieldID": 0,
	"insertAndClose": 0,
	"galleryID": "",
	"notice2": "Media Manager: Some media were not added because names already in use (csm_us_ziehmvisionrfdhybridedition-usa-forweb_1080x1080px_7c9dea3ab6.jpg)."
}

But there is no message output in the GUI after upload.

153486760_2023-02-23-131656.thumb.png.df5b2de8200e78fba07399bfef5bf1b0.png

In this case a duplicate image was ignored for upload. Are these JSON responses supposed to be shown as messages in the GUI? If not, it would be awesome if they could be shown to the user.

  • Like 1
Link to comment
Share on other sites

@kongondo Pre-sale question: Does MM have a setting for overwriting existing files/images when updating? It seems like it would.

As an example let's say I have tiger.jpg and want to update the image with lion.jpg...but keep the name tiger.jpg while displaying the new lion.jpg...does that make sense 🤨

Link to comment
Share on other sites

On 2/23/2023 at 7:20 PM, Jim Bailie said:

@kongondo Pre-sale question: Does MM have a setting for overwriting existing files/images when updating? It seems like it would.

As an example let's say I have tiger.jpg and want to update the image with lion.jpg...but keep the name tiger.jpg while displaying the new lion.jpg...does that make sense 🤨

Hi @Jim Bailie,

Apologies for the delay in responding. Thanks for the interest in MM. There is a setting for what to do when an attempt is made to upload a media whose filename matches one that already exists in the Media Library. The current options are skip  / rename /  replace. This currently does not cover your use case. This is because currently the media page is automatically created (on upload) off of the file name. Hence, in your case, lion.jpg would create a new media page title Lion.

A similar request to yours has been made with respect to replacing the media in a Media Manager inputfield that stores only one image. In order to replace the media, one has to first delete the existing single media. It would be more intuitive and easier to (similar to PW) to just delete the existing media by the new one.

I am currently working on a new version of Media Manager that amongst other things will have an option to give uploaded media custom names instead of grabbing this from the file name. I can add your scenario usage to the TODO list for this next version.

  • Like 1
Link to comment
Share on other sites

On 2/15/2023 at 9:55 AM, gebeer said:

Hi, bringing this up again because I found the reason. On install of MM, the children under Admin->MediaManager got named "media-manager--image", --audio etc. No idea how this happended, though.

Great work! Thanks @gebeer. I wonder if sanitizer name has something to do with this? 

On 2/15/2023 at 9:55 AM, gebeer said:

A check in MediaManagerActions.php around  L1575  for $parent instancof NullPage or the like would be great to at least issue a warning.

Thanks for the suggestion. Noted for the next version.

On 2/23/2023 at 6:23 AM, gebeer said:

In this case a duplicate image was ignored for upload. Are these JSON responses supposed to be shown as messages in the GUI? If not, it would be awesome if they could be shown to the user.

They are meant to show after bulk actions such has publishing, deleting, etc. as well as when uploads are done via drag and drop (in single or all media pages and when uploading directly to an MM Inpufield). In my testing now, I see the notifications in the GUI (upper right) except for when uploading via drag and drop in the single or all media pages in MM. I'll look into this in the next version.

Link to comment
Share on other sites

Hi all,

Media Manager Next/013

Sorry I haven't posted here in a while. 

I am currently working on the next version of Media Manager. It will part be refactoring and part be some new (some requested) features. I have been having some very helpful conversations with a number of you. Below are the current plans for the next version. Any other thoughts and/or ideas I should consider? It is a bit of work so I might have to stretch this into several updates (versions). Thanks.

New Features

  1. Upload from external sources (Amazon, Google, etc.).
  2. Point media to external resource (e.g. to a video in YT, Vimeo, etc.).
  3. Independently set media title on upload 
  4. Improve/extend media filter/profiles to MM Inputfields (possibly pick and apply a profile from a list) (thanks @gebeer)
  5. PDF thumb preview (thanks @gebeer)
  6. Upload and replace media (for single media MM inputfields).
  7. API (thanks @MrSnoozles)
  8. Any other thoughts.....?

Refactor

  1. Remove dependency on JqueryFileUpload
  2. Remove dependency on jQuery -> use htmx and alpine JS instead. Easier to maintain for me as well as more flexibility.
  3. Improved preview of media and their properties.
  4. Better preview of media before upload.
  5. Redesigned GUI - Intuitive (like GDrive(?)), do away with media menus (use filters instead), need oMedia is just media.
  6. Remove/reduce use of modals.
  7. Allow grouping of media (link an album) <- not yet confirmed if will be implemented
  8. Implement hookable methods to allow easier developer control for those who need advanced/custom control of their MM.

A number of reported bug fixes as well.

ETA? I cannot give a firm date about this, sorry.

Edited by kongondo
Added new feature 'API'
  • Like 2
  • Thanks 1
Link to comment
Share on other sites

6 minutes ago, Jim Bailie said:

Two months or less? 😜

Tight! Perhaps I could start with a soft upgrade/update that includes a hook that will allow you to retain names but not sure how this would work at the moment.

Having said that, you can achieve what you need manually (not ideal, I know)....by opening the media for editing (in MM), uploading your new image and deleting the old one. 
Save and you are done. In future I'll think of how one can drag and drop over an existing media to replace it.

Link to comment
Share on other sites

Quote

Tight! Perhaps I could start with a soft upgrade/update

Thank you! That's ok, no rush! This is a slow moving rebuild of an ancient application.

We have to be careful because once images are programmatically migrated by request to the old app, the links can never change from that point. And we have to make sure it's somewhat bullet-proof because of the non-technical skill levels of the admins.

And MM would be great for their workflow.

However, as far as pdf files go, which I'd like to have in place soon, I did find the module "Files Rename Replace" which gets me to a place where we can start testing/demo'ing

  • Like 1
Link to comment
Share on other sites

Two questions where I just read that you are working on a new version.

1. what about focus points, can I define them differently on a per page basis? Or is a set focus the same for all instances of the image? If so, I would like to see this feature that I can define a different focus per page where I use an image.

2. if I buy a license for the current version now, will it be updateable for the new version or are there any breakers here. I'm building a new project with thousands of images to be managed through the MM, so if in half a year, or whenever the new version is ready, a complete reinstall or upload is necessary, I'd rather wait until you have the new version ready.

  • Like 1
Link to comment
Share on other sites

Hi @David Karich,

19 hours ago, David Karich said:

1. what about focus points, can I define them differently on a per page basis? Or is a set focus the same for all instances of the image? If so, I would like to see this feature that I can define a different focus per page where I use an image.

I would have to look into this since I haven't worked with focus points before. My guess is that they are saved with the image, in which case they will be saved with the record for the original image in the MM page (i.e., not the page where the MM image is referenced in an MM Inputfield). I'll see if/how I can extend FieldtypeMediaManager to store focus information (and perhaps other info developers might be interested in) which you will be able to access via the MM object.

19 hours ago, David Karich said:

2. if I buy a license for the current version now, will it be updateable for the new version or are there any breakers here. I'm building a new project with thousands of images to be managed through the MM, so if in half a year, or whenever the new version is ready, a complete reinstall or upload is necessary, I'd rather wait until you have the new version ready.

I am hoping there will be no need for breaking changes. However, until I finish building it, I cannot promise. If such changes are inevitable, I'll provide code for migration. However, with the minimal progress I've made so far, I haven't encountered any breaking changes.

Link to comment
Share on other sites

On 3/1/2023 at 6:26 PM, kongondo said:

Hi @David Karich,

I would have to look into this since I haven't worked with focus points before. My guess is that they are saved with the image, in which case they will be saved with the record for the original image in the MM page (i.e., not the page where the MM image is referenced in an MM Inputfield). I'll see if/how I can extend FieldtypeMediaManager to store focus information (and perhaps other info developers might be interested in) which you will be able to access via the MM object.

I am hoping there will be no need for breaking changes. However, until I finish building it, I cannot promise. If such changes are inevitable, I'll provide code for migration. However, with the minimal progress I've made so far, I haven't encountered any breaking changes.

Hi @kongondo

thank you for your feedback. Since you still ask for wishes for the new version, here are two more. 😃

Just like the focus point, it would be very helpful to save the image description differently per page base. Example: I want to use a image several times in an article, but I want a different caption in each article.

And the biggest wish I have to pass on: Folder, folder, folder. My clients love thinking in folders. It doesn't even have to be a real folder for PW, but just a "fake page tree". The main thing is to have the feeling of having something organised. In this context, a configuration would of course be necessary, where you can, for example, specify where the image is automatically categorised when uploading.

An example of how it is solved, for example, in the WP-media Library as an extra plugin. Article: https://devowl.io/2020/create-folders-in-wordpress-media-library/

image.thumb.jpeg.18b5e987527844992adb0ae7c204bf3b.jpeg

  • Like 4
Link to comment
Share on other sites

9 hours ago, David Karich said:

And the biggest wish I have to pass on: Folder, folder, folder. My clients love thinking in folders.

Same experience with our clients. They are coming from TYPO3 and are used to organize media in folders. Trying to explain that the MM approach is much more flexible. But they'd still love to have their folders back. Technically this would mean that there is some kind of default categorisation apart from media type. I think using tags would be the best and most flexible method.

  • Like 1
Link to comment
Share on other sites

Hi @David Karich,

On 3/6/2023 at 4:09 PM, David Karich said:

thank you for your feedback. Since you still ask for wishes for the new version, here are two more. 😃

Excellent! Keep them coming please! 😄 .

On 3/6/2023 at 4:09 PM, David Karich said:

Just like the focus point, it would be very helpful to save the image description differently per page base. Example: I want to use a image several times in an article, but I want a different caption in each article.

I think I could incorporate this in the FieldtypeMediaManager as well. It would have to cater for multilingual texts as well. The challenge would be the GUI. I'll have a think.

On 3/6/2023 at 4:09 PM, David Karich said:

And the biggest wish I have to pass on: Folder, folder, folder. My clients love thinking in folders. It doesn't even have to be a real folder for PW, but just a "fake page tree". The main thing is to have the feeling of having something organised.

I really love this idea! In a sense this is what I meant by 'Album/grouping of media' but you have articulated it way much better, so thanks! I agree; there is no need to make them 'real folders'. We just need to create a relationship at the DB level and show the virtual representation of that in the 'tree'.

On 3/6/2023 at 4:09 PM, David Karich said:

In this context, a configuration would of course be necessary, where you can, for example, specify where the image is automatically categorised when uploading.

The more I think about it the more I think we need to 'get rid' of the uploads page. It seems to me like an extra step that we don't need. Certainly many modern apps (that our clients could be used to) don't separate the 'upload' from the 'view'. It is a single view for both. Yes, we can have a setting for 'default' category, maybe even separate for the 4 media types (just brainstorming here!). Otherwise, if one drag and drops whilst viewing a certain category, that media will be assigned to that category.

Can a media belong to more than one category? Either way is doable; I am just curious about your experience and/or the WP plugin.

On 3/7/2023 at 1:57 AM, gebeer said:

But they'd still love to have their folders back. Technically this would mean that there is some kind of default categorisation apart from media type. I think using tags would be the best and most flexible method.

Virtual folders would provide the best of both worlds. Clients get to see their folders but behind the scenes we continue to use the ProcessWire/MM way. By tags, do you mean the inbuilt ProcessWire image/file fields tags?

 

A question to you all, how does the powerful but potentially confusing inputfield selector work for your clients? Do they use it or would you prefer a simpler interface such as the WP one in the screenshot shown above by @David Karich?

Thanks!

 

Link to comment
Share on other sites

Hi @kongondo

First of all thank you for the awesome plugin!

1 hour ago, kongondo said:

A question to you all, how does the powerful but potentially confusing inputfield selector work for your clients? Do they use it or would you prefer a simpler interface such as the WP one in the screenshot shown above by @David Karich?

It would be really awesome if the selection would run through an interface with a folder structure. And it would be perfect if one could define per template in which folder the selection would start.

An example: Assuming we have a folder "Employee photos" and a folder "Customers" (or a lot more folders and subfolders 😉 ), then it would be perfect if one could give the input field the information that the image selection on employee detail pages starts in the folder "Employee photos". That would be much easier for the clients/editors to work with.

And without a folder structure, it would be great if one could define per template with which category or tag the input field starts, i.e. to have a ore-defined filter setting per template.

  • Like 2
Link to comment
Share on other sites

Hi @nurkka,

Thanks for chiming in.

1 hour ago, nurkka said:

It would be really awesome if the selection would run through an interface with a folder structure.

Yes. Perhaps my question wasn't clear. I am all for this folder structure. What I was referring to in my question about inputfield selector is whether we could also simplify that. So, yes, I definitely love the folder structure and will definitely prioritise that. 

 

1 hour ago, nurkka said:

An example: Assuming we have a folder "Employee photos" and a folder "Customers" (or a lot more folders and subfolders 😉 ), then it would be perfect if one could give the input field the information that the image selection on employee detail pages starts in the folder "Employee photos". That would be much easier for the clients/editors to work with.

This is a very interesting suggestion, thanks! I really like it as well! I think it would tie in nicely with the request to make it easier to use profiles in inputfield media manager. 

@David Karich (or any other person who knows), in the WP Media Lib, if the user clicked on the folder 'People', would that then display media for both 'Men' and 'Women' but if they clicked on 'Women' that will only show 'Women' media? I can't tell because the counts are not showing for some 'parent' folders such as 'People' and 'Office'.

Link to comment
Share on other sites

15 hours ago, kongondo said:

@David Karich (or any other person who knows), in the WP Media Lib, if the user clicked on the folder 'People', would that then display media for both 'Men' and 'Women' but if they clicked on 'Women' that will only show 'Women' media? I can't tell because the counts are not showing for some 'parent' folders such as 'People' and 'Office'.

@kongondo Sorry, I'm a bit tied up at the moment. But it behaves like real folders. When you click on "People", only two folders are displayed, but no pictures from both subfolders. I would also prefer this. Inheriting subitems in the view works well for a few folders, but not for 20, 50, 100 and then recursively over several levels lower.

  • Like 1
Link to comment
Share on other sites

Hi @kongondo

2 hours ago, kongondo said:

Yes. Perhaps my question wasn't clear. I am all for this folder structure. What I was referring to in my question about inputfield selector is whether we could also simplify that.

It would be nice to have a full text search, which would always be visible.
If this is not possible, it would be nice, if the filter would be always open, so one can start typing immediately and previously set filter values would be visible right away.

Also a more compact view for pdf documents would be great, because the current grid and list view both require a lot of space if one has some hundred pdfs in the library. In a past project I added the pdf filenames to the grid view by modifiying some javascript files, to have a more compact view with the filenames visible. Perhaps, pdf icons could be a lot smaller or omitted at all in the document view.

The UI elements could be smaller and information like how many times an image was used, filesize, etc. could be hidden and made visible with a toggle button, so everything would take up less space and more image and document items would fit on the screen.

  • Like 1
Link to comment
Share on other sites

13 hours ago, kongondo said:

Otherwise, if one drag and drops whilst viewing a certain category, that media will be assigned to that category.

That would be perfect! ATM there are too many steps involved when tagging uploaded media. Doing the tagging based on the "folder" would be a big improvement.

 

13 hours ago, kongondo said:

Yes, we can have a setting for 'default' category, maybe even separate for the 4 media types (just brainstorming here!).

I agree this should be separate from the media types. Maybe something like "uncategorized"

13 hours ago, kongondo said:

Can a media belong to more than one category? Either way is doable;

This should definitely be possible. So media that has multiple categories would appear in multiple virtual folders.

 

13 hours ago, kongondo said:

By tags, do you mean the inbuilt ProcessWire image/file fields tags?

Yes and no 🙂 The inbuilt image/file tags could be used in the background to store the tags. But for editing I would prefer if I did not have to edit an image before I can input tags. It would be cleaner and faster for editors if they can just edit tags directly without having to go the extra step to edit the image. So the tags field would have to live on the MM page that holds the media. Does that make sense?

Also there should be a way how we can pre-define available categories. Just like we can pre-define available tags for aan image/file field.

13 hours ago, kongondo said:

A question to you all, how does the powerful but potentially confusing inputfield selector work for your clients? Do they use it or would you prefer a simpler interface

The simpler the better 🙂 Almost all of my clients are overwhelmed by PW Lister filters. Even with predefined filter profiles it is hard for non-techy people to understand the concept and what they see in the dropdown selects. I think this is a very tough one to tackle. If you have just one search input like in WP, you get back results that you where not looking for because the search is too broad. Maybe a combination of a text input that searches for file names and one select dropdown that determines the category you want to search in could work? 

7 hours ago, David Karich said:

When you click on "People", only two folders are displayed, but no pictures from both subfolders. I would also prefer this. Inheriting subitems in the view works well for a few folders, but not for 20, 50, 100 and then recursively over several levels lower.

Totally agree. It could be a configurable option whether to include files from subfolders in the view or not.

5 hours ago, nurkka said:

Also a more compact view for pdf documents would be great, because the current grid and list view both require a lot of space if one has some hundred pdfs in the library. In a past project I added the pdf filenames to the grid view by modifiying some javascript files, to have a more compact view with the filenames visible. Perhaps, pdf icons could be a lot smaller or omitted at all in the document view.

Great suggestions. For the time being a config option for icon size would be helpful. Or do the Preview maximum width/height settings already have an effect on those icons?    

  • Like 1
Link to comment
Share on other sites

  • Grzegorz changed the title to Media Manager links

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...