Jump to content

Media Manager Archive


kongondo

Recommended Posts

  On 9/11/2022 at 10:52 AM, kongondo said:

This is a relatively old version of ProcessWire. Any reason why you are not on the latest main/master version (3.0.200) at least?

Expand  

No special reason. Maybe it's the best, I install a fresh new system and media manager again. Now its only a small test/experimental system. It is enough to backup the /site/modules/ProcessMediaManagermediamanager folder for later re-install Media Manager?

Link to comment
Share on other sites

  On 9/11/2022 at 11:12 AM, kono said:

Maybe it's the best, I install a fresh new system and media manager again.

Expand  

Yes. It is a good idea, especially if you want to take advantage of newer features. I am not saying it is the reason for the errors you are experiencing. ProcessWire tends to be very stable across versions. It could be a case of Media Manager using one of the newer ProcessWire features. 

  On 9/11/2022 at 11:12 AM, kono said:

It is enough to backup the /site/modules/ProcessMediaManagermediamanager folder for later re-install Media Manager?

Expand  

Upgrading ProcessWire is mainly a matter of swapping out /wire/ with the current latest one. However, some files such as index.php, .htaccess might also need overwriting with their latest counterparts. However, just in case something went wrong, it is a good idea to create a database backup of your site in case you needed to roll back. In the case of Media Manager itself, if you have implemented lots of changes and uploads, you might want to back those up. However, if you don't mind losing these (since you are still experimenting), I'd start from scratch. As for the Media Manager files themselves, the ProcessWire upgrade will not affect them. However, to ensure a fresh start, it is better to fully uninstall Media Manager, then upgrade ProcessWire. In summary:

  1. Create a whole site backup (e.g. using ProcessDatabaseBackups or some other database tool).
  2. Completely uninstall Media Manager.
  3. Upgrade ProcessWire. Please see the docs here.
  4. If the upgrade goes OK, do a module refresh on the site.
  5. Install & enable Tracy Debugger (if you don't have it already).
  6. Re-install Media Manager.
  7. Test Media Manager features.

Please let me know how it goes.

  • Like 1
Link to comment
Share on other sites

I have updated now to the latest pw version - it seems the Media Manager problem has vanished into thin air ?

I am now trying everything exactly and will give you feedback again later...

Thank you very much for your very quick an friendly help!

Kono

Link to comment
Share on other sites

Hi @kongondo,

thank you very much! It's done and works so fare. I have deleted the account again.

Some more question for understanding, sorry:
Do I necessarily need the html tags for the frontend output (e.g. video):

echo "<video width=320 height=240 controls>";
echo "<source src='" . $m->media->url . "'type=video/mp4>";
echo "</video>"


Or should that be enough to render a player in the frontend?

echo $m->media_manager_video->url

What is the shortest way to render the player in the frontend?

Thanks for the effort!

Kono

Link to comment
Share on other sites

Hi @kono,

  On 9/12/2022 at 11:09 PM, kono said:

What is the shortest way to render the player in the frontend?

Expand  

Echoing the field ?. Media Manager field has as toString() method.

<?php

namespace ProcessWire;

// toString()
echo $page->name_of_your_media_manager_field;

The above will render each item in the media manager field according to its type, i.e. audio (audio player), video (video player), image (thumb 400px wide, height auto) or document (file name with URL - viewable in browser or downloadable depending on document extension) Please see the docs here.

Hope this helps.

  • Like 1
Link to comment
Share on other sites

  • 1 month later...
  On 10/18/2022 at 9:18 AM, zoeck said:

Do you even need it? Normally you can access the field directly: $page->name-of-the-field
Or do you have an example where it is needed?

Expand  

Grüß Gott ?

If I use it like you mentioned it, I will get my image with HTML-Tag. F.E.: $page->name-of-the-field returns <img src="path/img.jpg" />
But I need the path to the image only to use it as a background-image.

Thank you

Link to comment
Share on other sites

Hi @bubu2110,

Welcome to the forums.

  On 10/18/2022 at 1:43 PM, bubu2110 said:

But I need the path to the image only to use it as a background-image.

Expand  

Please see the following documentation for Media Manager:

  1. Media Manager Objects - link.
  2. Accessing Media Manager Objects Properties - link.

Other topics listed under Frontend Output of Media Manager Fields would also be of interest.

Please let me know if you require further assistance.

Link to comment
Share on other sites

Hi @kongondo and many thanks for this great module.

I just installed it on PW 3.0.200 / PHP 7.4 and encountered an issue with uploads of SVG, be it from the MM Upload section or the mm field that I created for type images. 
FileValidatorSvgSanitizer is also installed.

There is a PHP Warning related to JqueryFileuploads module

jqfu-error.png.ad5c06e93d6ea34bcebab5da1cd3ab3d.png

Problem is the getImagesize($imageFile) call which returns false for SVG images. I scanned the JqueryFileuploads thread for posts related to SVG and found none. Wondering if I'm the first one encounterng this. Maybe because it is "just" a Warning and not and Error. I have set Tracy Debugger to strict mode in all of my projects.

On https://www.php.net/manual/en/function.getimagesize.php they explicitly say not to use getimagesize for detecting mime size and recommend https://www.php.net/manual/en/function.finfo-file.php instead.
Is it possible to make the option allowedImageMimeTypes configurable through module settings or to hardcode image/svg+xml as allowed image mime type into the module? This would make it easier to do mime type validation for svg with finfo_file(). Something like

// if (function_exists('exif_imagetype')) { ...
} elseif (function_exists('finfo_file')) {
	$finfo = finfo_open(FILEINFO_MIME_TYPE); // return mime type ala mimetype extension
	if (in_array(finfo_file($finfo, $imageFile), $allowedImageMimeTypes)) $isValidImage = true;
}
// ...

Or https://www.php.net/manual/en/function.mime-content-type.php is also an option.

Feel free to move this to the JqueryFileuploads thread.

 

  • Like 1
Link to comment
Share on other sites

Hi @gebeer,

Thanks for using MM.

  On 10/20/2022 at 11:53 AM, gebeer said:

There is a PHP Warning related to JqueryFileuploads module

Expand  

Thanks for reporting this.

  On 10/20/2022 at 11:53 AM, gebeer said:

On https://www.php.net/manual/en/function.getimagesize.php they explicitly say not to use getimagesize for detecting mime size and recommend https://www.php.net/manual/en/function.finfo-file.php instead.

Expand  

I went through a lot of back and forth with this module in this respect. There were a number of conflicting experiences and/or recommendations out there. For instance:

  On 10/20/2022 at 11:53 AM, gebeer said:
$finfo = finfo_open(FILEINFO_MIME_TYPE); // return mime type ala mimetype extension
Expand  

The above is considered by some to be insecure.

  On 10/20/2022 at 11:53 AM, gebeer said:
Expand  

I had this as an option for a time until I found out it was deprecated. But I have now found it was 'un-deprecated'!

  On 10/20/2022 at 11:53 AM, gebeer said:

Is it possible to make the option allowedImageMimeTypes configurable through module settings or to hardcode image/svg+xml as allowed image mime type into the module? This would make it easier to do mime type validation for svg with finfo_file().

Expand  

I'll have a think as I am in the process of writing the next version of MM. JFU will no longer be a dependency. In fact, we won't even need jQuery for it.

Link to comment
Share on other sites

  On 7/20/2017 at 9:41 PM, kongondo said:

Media Manager version 011  (released 20/07/2017)

Happy to announce the latest release of Media Manager.

Changelog

  1. Fixed bug that caused required Media Manager fields to still be labelled as 'missing required value' even when they were populated.
Expand  

Sorry to say that this error still occurs in my multilang install using PW 3.0.200 on PHP 7.4 both outside and inside repeaters. Required option set either in field or template context yields the same result.

Problem seems to be with the isEmpty() method in InputfieldMediaManager.module. Specifcally with get_class($value) == 'MediaManagerArray'. In my install get_class($value) returns 'ProcessWire\MediamanagerArray'.

If I replace the check with

		if(is_object($value) && $value instanceof MediaManagerArray && count($value)) $empty = false;

the error is gone.

  • Like 1
Link to comment
Share on other sites

  On 10/26/2022 at 5:38 AM, gebeer said:

Problem seems to be with the isEmpty() method in InputfieldMediaManager.module. Specifcally with get_class($value) == 'MediaManagerArray'. In my install get_class($value) returns 'ProcessWire\MediamanagerArray'.

Expand  

Thanks for reporting. Looks like a rookie mistake on my part. 

  On 10/26/2022 at 5:38 AM, gebeer said:
if(is_object($value) && $value instanceof MediaManagerArray && count($value)) $empty = false;
Expand  

Good solution. I'll probably use wireClassName() or wireInstanceOf().

  • Like 1
Link to comment
Share on other sites

  On 10/26/2022 at 4:35 PM, kongondo said:

Good solution. I'll probably use wireClassName() or wireInstanceOf().

Expand  

I changed my code to use wireInstanceOf(). Works like a charm.

Today another problem surfaced. The MM Settings do not get saved when the core module PagePaths is installed.

Located the cause in ProcessMediaManager.module L156

		$mediaManagerSettings = $this->wire('pages')->get("template=media-manager-settings, parent={$path},include=hidden")->media_manager_settings;

When PagePaths is not installed, the selector returns the page under Admin->Media Manager->Media Manger:Settings just fine.

But with PagePaths installed it returns a NullPage. I found that with PagePaths installed page paths change to also include the language name, but not consistently. My install sets the home URL for the default language to "mydomain.com/en/". The paths that are returned look like

$pages->get('template=media-manager-settings')->path // "/en/processwire/media-manager/media-manager--settings/" (note the '/en/' at the beginning).

$pages->get('name=media-manager')->path // "/processwire/media-manager/"

$config->urls->admin // "/processwire/"

There is the inconsistency. Pages with template admin do not have the language prepended while pages with other templates do. Guess this implementation makes sense. 

When I remove "parent={$path}" from the selector, it works with PagePaths installed. I implemented a quickfix like this

		/******** - MEDIA MANAGER SETTINGS - *******/
		$path = $config->urls->admin . 'media-manager/';
		$selector = "template=media-manager-settings, status<" . Page::statusTrash;
		if(!$this->wire('modules')->isInstalled('PagePaths')) $selector .= ", parent={$path}";
		$mediaManagerSettings = $this->wire('pages')->get($selector)->media_manager_settings;

I left out the "include=hidden" since $pages->get() returns hidden pages by default.

Is "parent={$path}" needed at all, can there be situations where multiple pages with template media-manager-settings are present in the system? Maybe in the Trash. So I handled that situation. 

Please let me know what you think. Thank you.

  • Like 1
Link to comment
Share on other sites

  On 10/27/2022 at 8:15 AM, gebeer said:

Today another problem surfaced. The MM Settings do not get saved when the core module PagePaths is installed

Expand  

Great catch! Some users have reported this in the past but never managed to nail it down to PagePaths! 

  On 10/27/2022 at 8:15 AM, gebeer said:

Please let me know what you think.

Expand  

I'll have a play and get back to you.

Thanks!

  • Like 1
Link to comment
Share on other sites

@kongondo I have a MM field "icons", allowed media types images. When adding an image via "Add Image", the MM modal pops up and shows all files of type image. I'd like to automatically apply a filter (profile) so that only images with tag 'icon' and extension svg are being listed. Otherwise editors have to manually choose a filter each time.
"Add Image" issues a request which contains a property "filters". But in the field settings I don't see how I could configure which filters to apply.
Is this scenario possible at all?

  • Like 1
Link to comment
Share on other sites

  On 10/28/2022 at 9:14 AM, gebeer said:

But in the field settings I don't see how I could configure which filters to apply.
Is this scenario possible at all?

Expand  

Hi @gebeer. I have now added this feature to MM 013. I have also added fixes for the issues you've raised above (MM missing required value; PagePaths vs settings issue and finfo_open(FILEINFO_MIME_TYPE) for JqueryFileUpload). Are you able to please test this new version for me before I release it? I have sent you a PM with details. Please note this version needs version 009 of JFU.

Thanks.

Edited by kongondo
Link to comment
Share on other sites

  • 4 weeks later...

Hi,

I once bought a license years ago, now I wanted to install MM again.
I have version 0.12 B, installed with PW 3.0.200 and Jquery File Upload 0.0.9, at first glance everything looks good.

I can upload images in the admin, these also appear, but now the curious, as soon as I click on an image on Edit the image is deleted.

In the logs also appears "rmdir: Unable to rmdir: /site/assets/cache/FileCompiler/".

All this is installed on a local environment with DDEV and PHP 7.4 ...

Any idea what could be the reason for this?

Greetings

Link to comment
Share on other sites

@kongondo Media Manager fields always return a MediaManagerArray, even if Maximum Media Allowed is set to 1. This is not bad at all but it would be great if the logic would follow PageFiles or Page Reference field conventions. There we can choose whether to return an Array or a single object.
So for Media Manager fields it would be nice to have that option, too. Or a default behaviour where fields with max allowed 1 return a single MediaManager object because returning an array doesn't really make sense in that context.

Link to comment
Share on other sites

@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?

Link to comment
Share on other sites

  On 11/29/2022 at 10:52 AM, gebeer said:

@kongondo Media Manager fields always return a MediaManagerArray, even if Maximum Media Allowed is set to 1. This is not bad at all but it would be great if the logic would follow PageFiles or Page Reference field conventions. There we can choose whether to return an Array or a single object.
So for Media Manager fields it would be nice to have that option, too. Or a default behaviour where fields with max allowed 1 return a single MediaManager object because returning an array doesn't really make sense in that context.

Expand  

Good idea. I'll and this on my todo list.

  On 11/30/2022 at 11:56 AM, 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?

Expand  

I have no idea. I'll test here and let you know, thanks.

Link to comment
Share on other sites

  On 11/23/2022 at 4:02 PM, entschleunigung said:

Hi,

I once bought a license years ago, now I wanted to install MM again.
I have version 0.12 B, installed with PW 3.0.200 and Jquery File Upload 0.0.9, at first glance everything looks good.

I can upload images in the admin, these also appear, but now the curious, as soon as I click on an image on Edit the image is deleted.

In the logs also appears "rmdir: Unable to rmdir: /site/assets/cache/FileCompiler/".

All this is installed on a local environment with DDEV and PHP 7.4 ...

Any idea what could be the reason for this?

Greetings

Expand  

Hi @entschleunigung. Sorry for a very late reply! I missed your post.

I have no idea what's happening. Are you able to please try with a different ProcessWire version? I don't recall anyone ever reporting a similar issue.

Link to comment
Share on other sites

  • kongondo changed the title to Media Manager Archive
  • kongondo pinned and locked this topic
Guest
This topic is now closed to further replies.
×
×
  • Create New...