kono Posted September 11, 2022 Posted September 11, 2022 13 minutes ago, 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? 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?
kongondo Posted September 11, 2022 Author Posted September 11, 2022 24 minutes ago, kono said: Maybe it's the best, I install a fresh new system and media manager again. 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. 24 minutes ago, kono said: It is enough to backup the /site/modules/ProcessMediaManagermediamanager folder for later re-install Media Manager? 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: Create a whole site backup (e.g. using ProcessDatabaseBackups or some other database tool). Completely uninstall Media Manager. Upgrade ProcessWire. Please see the docs here. If the upgrade goes OK, do a module refresh on the site. Install & enable Tracy Debugger (if you don't have it already). Re-install Media Manager. Test Media Manager features. Please let me know how it goes. 1
kono Posted September 11, 2022 Posted September 11, 2022 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
kongondo Posted September 11, 2022 Author Posted September 11, 2022 14 minutes ago, kono said: I have updated now to the latest pw version - it seems the Media Manager problem has vanished into thin air ? Excellent! Glad you got it sorted!
kono Posted September 12, 2022 Posted September 12, 2022 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
kongondo Posted September 13, 2022 Author Posted September 13, 2022 Hi @kono, 16 hours ago, kono said: What is the shortest way to render the player in the frontend? 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. 1
kono Posted September 13, 2022 Posted September 13, 2022 Hi @kongondo, that is really very simple. Sometimes I can't see the forest for the trees ? Thank you very much! 1
kongondo Posted September 13, 2022 Author Posted September 13, 2022 1 hour ago, kono said: Thank you very much! No worries! :-). 1
bubu2110 Posted October 18, 2022 Posted October 18, 2022 Hey guys, I need your help please. How can I use the ToString() function? Is it $page->name-of-the-field->ToString()? Thank you Mats
zoeck Posted October 18, 2022 Posted October 18, 2022 33 minutes ago, bubu2110 said: How can I use the ToString() function? 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?
bubu2110 Posted October 18, 2022 Posted October 18, 2022 4 hours ago, 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? 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
kongondo Posted October 18, 2022 Author Posted October 18, 2022 Hi @bubu2110, Welcome to the forums. 20 minutes ago, bubu2110 said: But I need the path to the image only to use it as a background-image. Please see the following documentation for Media Manager: Media Manager Objects - link. 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.
gebeer Posted October 20, 2022 Posted October 20, 2022 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 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. 1
kongondo Posted October 20, 2022 Author Posted October 20, 2022 Hi @gebeer, Thanks for using MM. 4 hours ago, gebeer said: There is a PHP Warning related to JqueryFileuploads module Thanks for reporting this. 4 hours ago, 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. 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: 4 hours ago, gebeer said: $finfo = finfo_open(FILEINFO_MIME_TYPE); // return mime type ala mimetype extension The above is considered by some to be insecure. 4 hours ago, gebeer said: Or https://www.php.net/manual/en/function.mime-content-type.php is also an option. 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'! 4 hours ago, 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(). 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.
gebeer Posted October 26, 2022 Posted October 26, 2022 On 7/21/2017 at 4:41 AM, kongondo said: Media Manager version 011 (released 20/07/2017) Happy to announce the latest release of Media Manager. Changelog Fixed bug that caused required Media Manager fields to still be labelled as 'missing required value' even when they were populated. 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. 1
kongondo Posted October 26, 2022 Author Posted October 26, 2022 10 hours ago, 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'. Thanks for reporting. Looks like a rookie mistake on my part. 10 hours ago, gebeer said: if(is_object($value) && $value instanceof MediaManagerArray && count($value)) $empty = false; Good solution. I'll probably use wireClassName() or wireInstanceOf(). 1
gebeer Posted October 27, 2022 Posted October 27, 2022 14 hours ago, kongondo said: Good solution. I'll probably use wireClassName() or wireInstanceOf(). 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. 1
kongondo Posted October 27, 2022 Author Posted October 27, 2022 43 minutes ago, gebeer said: Today another problem surfaced. The MM Settings do not get saved when the core module PagePaths is installed Great catch! Some users have reported this in the past but never managed to nail it down to PagePaths! 47 minutes ago, gebeer said: Please let me know what you think. I'll have a play and get back to you. Thanks! 1
gebeer Posted October 28, 2022 Posted October 28, 2022 @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? 1
kongondo Posted October 29, 2022 Author Posted October 29, 2022 (edited) 15 hours ago, 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? 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 October 29, 2022 by kongondo
entschleunigung Posted November 23, 2022 Posted November 23, 2022 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
gebeer Posted November 29, 2022 Posted November 29, 2022 @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.
gebeer Posted November 30, 2022 Posted November 30, 2022 @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?
kongondo Posted December 3, 2022 Author Posted December 3, 2022 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. 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? I have no idea. I'll test here and let you know, thanks.
kongondo Posted December 3, 2022 Author Posted December 3, 2022 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 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.
Recommended Posts