Jump to content

Recommended Posts

Obviously ImageMagick causes this bug in combination with uploading JPG files, according to the AJAX error message. After deinstalling the IMagick Image Sizer module, uploading JPGs is no problem.

This was my test case:

  1. Uploading the PNG file testupload1png.png
    • With ImageMagick: upload works 👍🏻
    • Without ImageMagick: upload works 👍🏻
  2. Uploading the same image as above converted into the JPG file testupload1jpg.jpg
    • With ImageMagick: upload results in an error message and doesn’t show up in Media Manager. 👎🏻
      AJAX error message: “no decode delegate for this image format `JPEG' @ error/constitute.c/ReadImage/504”
    • Without ImageMagick: upload works 👍🏻
  3. Uploading a second PMG file testupload2png.png
    • With ImageMagick: upload works 👍🏻 AND somehow “pushes” the failed JPG upload into the Media Manager, so now all three uploaded files show up as they should.
    • Without ImageMagick: upload works 👍🏻

I guess I can now either not use ImageMagick (which I just used because my hoster provides it on their servers as a default and it was recommended because of better memory usage). Or I can ask the support of my hoster about this problem.

Link to post
Share on other sites

Aah, we've got it nailed down at last! The issue, as per the error message and a bit of Googling, is an ImageMagick bug/issue. There are several solutions out there. ImageMagick is a very good library. Before giving up on it, ask your hoster (if you don't have access yourself) to resolve the issue given that there are several solutions out there. Some resolutions simply involve recompiling the library. Here are a few examples of the 'bug':

  1. https://stackoverflow.com/questions/9586048/imagemagick-no-decode-delegate
  2. https://www.imagemagick.org/discourse-server/viewtopic.php?t=12366
  3. https://stackoverflow.com/questions/37594157/imagemagick-no-decode-delegate-for-this-image-format-error-constitute-c-re
  4. http://www.imagemagick.org/discourse-server/viewtopic.php?t=32287
Link to post
Share on other sites
14 hours ago, tooth-paste said:

Is it possible to only show 'Audio' and hide tabs like 'Documents' and 'Images'?

Yes. However, in the current version, this only works from the inputfield/fieldtype side of things, i.e. when adding media (in media manager library) to a media manager field on a page. When accessing the media library directly, one sees all the 4 media types. However, on the dev version that I'm still working on (it has taken a while I know, but I'd rather get it right than hurry it through since it is a major release), one can control the 'global' visibility of media types as well as at the inputfield/fieldtype level. I'm not sure when the dev version will be ready though. I thought it would have been ready by now but that didn't happen, so, no more ETAs I'm afraid. 

Link to post
Share on other sites

I'am having some problems to output audio(mp3) files. I've installed Media Manager but don't 'get' it quit yet. The media manager is working and I can upload files.

My template is called 'prekenarchief' and placed the code from the documentation:

  

$media = $page->media;// returns a MediaManagerArray. Needs to be looped through

foreach ($media as $m) {
    echo $m->id;// e.g. 1234 (hidden page in /admin/media-manager/media-parent/)
    echo $m->type;// e.g. 3 (a media of type image) OR 1 (a media of type audio)
    echo $m->typeLabel;// e.g. 'document' (i.e. type would be 2)
    echo $m->title;// e.g. 'My Nice Trip' (whose media file could be my-nice-trip.mp4)
    /*
        @note: 
        - $m->media returns an object;
                   either a ProcessWire Image (for image media) or File object (for audio, document and video media)
        - This means you have access to all the properties of that object,
                   e.g. ext, tags, description, url, filename, basename, width, height,
                        modified, created, filesize, filesizeStr, etc
                        as well as associated methods, e.g. size()
    */ 
    
    echo $m->media->tags;
}

// only output images
foreach ($media as $m) {
    if($m->typeLabel =='image') {
        echo "<img src='" . $m->media->size(100,75)->url . "'><br>";
    }
    
}

// There's also a toString() method so you can do:
echo $page->media;

 

1. What do I need to add to the template to get it to work? I added a new field to the template called 'media', but it doesn't work.

2. Do I need to alter the example code above. For example: Do I need to place an ID. 

 

 

Link to post
Share on other sites
On 6/26/2018 at 3:35 PM, tooth-paste said:

The media manager is working and I can upload files.

Thanks for the purchase 🙂.

On 6/26/2018 at 3:35 PM, tooth-paste said:

I'am having some problems to output audio(mp3) files.

 

On 6/26/2018 at 3:35 PM, tooth-paste said:

1. What do I need to add to the template to get it to work? I added a new field to the template called 'media', but it doesn't work.

Is media a Media Manager field? If it is not, you need to first create and add a Media Manager field to your  prekenarchief template. You will then need to add the audio files you want to that field. There will be a link in the Media Manager inputfield to your Media Library. You can then use the code above.  This is the most common scenario/usage of Media Manager. You upload media to your Media Manager Library first. You then pick and choose the ones you want to add to a certain page. Finally, you access them using Media Manager API.

Alternatively, you can directly access the media in the Media Library from within your template file without first having to add them to a Media Manager field, e.g.:

/* @note:
  the Media Manager template for audio media is 'media-manager-audio'
  the field with the audio media is 'media_manager_audio'
  in this case, we use include=all OR check_access = 0 since media pages are access-controlled
  admin pages
*/
$media = $pages->find('template=media-manager-audio, include=all, limit=10');
// $media is a PageArray
foreach ($media as $m) {
   // media_manager_image is a Pagefiles so we need to loop through it but..
   // media_manager_audio (also document and video) is a Pagefile. No need to loop
   // example for image media (template = media-manager-image)
   //foreach ($m->media_manager_image as $image) echo $image->url;
   // example for audio/document/video media
   echo $m->media_manager_audio->url;
} 

This is not a common usage, but choose what fits your workflow best.

Edited by kongondo
Code correction
Link to post
Share on other sites

Thanks for your reply. Something is still not right. Could you check these settings?

I've created a field 'media' and added it to my template.

2085866872_Schermafbeelding2018-06-27om09_01_32.png.5a4fb521901beea9dddb2f3c4bf5ec42.png

 

When I try to add files the 'Insert media' button does not work. I have added files thru upload.

2010269875_Schermafbeelding2018-06-27om09_02_05.thumb.png.5ccfa46bd08c59429d807bce65950814.png

 

 

My template looks like this. But it brings no output to the front-end. Am I doing something wrong?

<?php include("./header.php"); ?>

<div class="container paddingbottom3 paddingtop2">
	<div class="row">
		<div class="col-md-12">
			<div class="row">
				<div class="col-md-6 bglichtgrijs link paddingbottom3">
					<div class="paddingleft4 paddingright5">
						<div class="paddingleft4">
							<h2>Preken</h2>
							
							<?php

								$media = $pages->find('template=media-manager-audio, include=all, limit=10');
								// $media is a PageArray
								foreach ($media as $m) {
								   // media_manager_image is a Pagefiles
									foreach ($m->media_manager_audio as $audio) echo $audio->url;
								}				
							?>
							
						</div>
					</div>
				</div>
				<div class="col-md-6 bggeel link paddingtop2 paddingbottom2">
					<h2 class="colorwit"><?php echo $page->title; ?></h2>
					<br /><br />
					<span class="glyphicon glyphicon-arrow-right colorwit paddingright5"></span><a href="/contact">Neem contact op</a>
				</div>
				
			</div>
		</div>
	</div>
</div>


<?php include("./footer.php"); ?>

 

 

Link to post
Share on other sites
On 6/27/2018 at 8:08 AM, tooth-paste said:

When I try to add files the 'Insert media' button does not work.

I can tell from your screen grab that the audio media 2212 is unpublished (the crossed eye icon). Unpublished media cannot be added to a Media Manager field, hence why insert media button doesn't do anything. In the upcoming version of MM, you will get a meaningful message/error if you try to add unpublished media to an MM field.

 

On 6/27/2018 at 8:08 AM, tooth-paste said:

My template looks like this. But it brings no output to the front-end. Am I doing something wrong?

Oops, my bad, sorry. Image media would have returned a Pagefiles but audio media should return a Pagefile. So, no need for inner foreach.

$media = $pages->find('template=media-manager-audio, include=all, limit=10');
// $media is a PageArray
foreach ($media as $m) {
	// media_manager_image is a Pagefiles but media_manager_audio is a Pagefile
	// so, no need to loop
	echo $m->media_manager_audio->url;// url to your audio media
}

Just a reminder that the above code is for Direct Access. Use it only if you want to access your media directly from your Media Library without having to add them to any page (i.e., to any MM field). In this case, you do not need the MM media field in your prekenarchief template.

Alternatively, to interact with a MM field, use the code in the documentation.

Edited by kongondo
Code correction
Link to post
Share on other sites

Hi,

Some time, without a reason, the modulo deletes the images. Do you know why?

I notice when a user enters these pages and in the backend appears the 404 error, I go to see and in fact the images inside the media manager are gone.

Someone knows why and what can I do?

--

Sorry @kongondo!!!! I'm really sorry  I got confused with Media Library module!!! 😨😓 

Edited by MarcoPLY
Link to post
Share on other sites
4 hours ago, MarcoPLY said:

Some time, without a reason, the modulo deletes the images. Do you know why?

Hi @MarcoPLY,

Please confirm you are talking about the commercial Media Manager module and not another module. Media Manager does not randomly delete images 🙂. I seem to recall you were using other modules for your media needs?

 

  • Sad 1
Link to post
Share on other sites

Hi kongondo,

we've bought Media Manager under ageny licence and we and our clients are happy with it. But there is actually a problem on a certain page: The integrated upload function no longer works with following exception (from log):

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'heikotel-hotel-am-stadtpark-buffet-2-9840a-1032' for key 'name_parent_id' (in /wire/core/WireDatabasePDO.php line 454) 

How can we fix this?

Another small question: Is there any possibility to get the real url to any media manager document directly from backend? I know how to render the url in my code (by $m->media->url), but some clients want to copy the url from media manager backend into other targets, but didn't found it (and me too). The url can be assembled by analyzing the source code, but this in no option for clients.

Thank you and Best regards,

Thomas.

Link to post
Share on other sites

@Thomas Scholz,

Welcome to the forums.

11 hours ago, Thomas Scholz said:

we've bought Media Manager under ageny licence and we and our clients are happy with it.

Thanks for the purchase.

11 hours ago, Thomas Scholz said:

But there is actually a problem on a certain page: The integrated upload function no longer works with following exception (from log):

Media are saved as pages, hidden away under Admin. It seems a situation occurred whereby the creation of a media page did not complete and subsequently, the media was re-uploaded and the module tried to create the page again. Since in PW, no pages under the same parent cannot share a name, you get the violation constraint. Was this a media with a big image you were trying to upload? Try deleting the page physically in your page tree: admin > media-manager > media-manager-image > heikohotel-hotel-am-stadtpark-buffet-2-9840a-1032. Make sure to delete it and also empty the trash. If not, you might have to physically delete the page entry in your DB. This situation has happened to me once or twice in the past. I know it is annoying, apologies. On a related note, Media Manager has a setting for handling duplicate media. I'm not sure why that did not kick in before your situation occurred. Most likely, like I said, a page creation did not complete. Let me know if you are still not able to resolve this and I can have a look if the site is online.

 

11 hours ago, Thomas Scholz said:

but some clients want to copy the url from media manager backend into other targets,

I am not sure I understand this. Do you mean, they want to link to media, for example, within text in CKEditor (either as an image or link)? If the answer is yes, just click on the image or link icons in CKEditor and you will see links to pick the media from Media Manager.

Link to post
Share on other sites

Thank you for your quick answers!

For the first point, the deletion of the concerning page was successful, but was followed by the next similar error with another media page. I will keep trying.

For the second point, the client doesn't need the link in CKEditor, but in Redirects module to set a shorter url for certain pdf documents. So I cant't explain him, how to obtain the original url/path from Media Manager to set as "redirect to".

Link to post
Share on other sites
29 minutes ago, Thomas Scholz said:

but was followed by the next similar error with another media page. I will keep trying.

Hmm. That's not ideal. This is not how MM usually works 🙂. What's your server environment? ProcessWire version?

30 minutes ago, Thomas Scholz said:

but in Redirects module to set a shorter url for certain pdf documents. So I cant't explain him, how to obtain the original url/path from Media Manager to set as "redirect to".

I have never used the Redirect module. Could you please show me a screenshot of the input where the URL is supposed to go? Do you need the URL or the path?

Link to post
Share on other sites

For Redirect module, we need the path, e.g. site/assets/files/1234/foo.pdf. This info I can take from source code view or browser dev tools, but for a non-programming-oriented editor ther is no chance to take it directly from Media Manager backend. I would prefer an additional line in document detail view containig the path or url (see attachment).

 

Media Manager Document Detail View Proposal.png

Link to post
Share on other sites
5 hours ago, Thomas Scholz said:

I would prefer an additional line in document detail view containig the path or url (see attachment)

Excellent idea! I'll add it in the next version of MM. Meanwhile, for now, you can edit the file MediaManagerRender.php and enter the following code after the Filename, i.e. on line #676:

'<span>' . $this->_('URL') . ':</span> ' . $m->httpUrl . '<br>' .

Please note, the output (URL) might be quite long, so the CSS could be off. However, I cannot work on this now since the new version of MM will have a different layout. It will present a challenge though since the descriptions, etc are viewable on hover. When the house is moved away, the overlay goes. This means, it will not be possible to copy the URL. I hope this makes sense. I will have to think more about this.

Link to post
Share on other sites
  • 3 weeks later...

We've been working on adding the media manger to our new project, but when we create a field to add images/videos to the page, we get the following error in Media Manager:

{"error":true,"message":"SQLSTATE[42S02]: Base table or view not found: 1146 Table 'cmsdev01.field_Product_Assets' doesn't exist"}

When we remove the field from the template (actually we have to delete the field entirely) then the Media Manger will load again and not display that error.  Is there something additional we need to do when we want to start adding Media Manager fields to pages?

Link to post
Share on other sites

Hi @Karinne Cyphers,

On 7/27/2018 at 1:34 AM, Karinne Cyphers said:

{"error":true,"message":"SQLSTATE[42S02]: Base table or view not found: 1146 Table 'cmsdev01.field_Product_Assets' doesn't exist"}

When we remove the field from the template (actually we have to delete the field entirely) then the Media Manger will load again and not display that error.  Is there something additional we need to do when we want to start adding Media Manager fields to pages?

I don't remember ever seeing this error in respect of Media Manager. A couple of questions:

  1. Do other fields, either in the same template or a different one work OK? For instance, text fields, etc
  2. Is the problem with this one template or have you tried a different template?
  3. Maybe there is an issue with the name of your field. Try renaming it to something else and use lower case letters only
  4. MySQL and PHP versions?

If possible, please post a screenshot or animated gif of the error, thanks.

Link to post
Share on other sites

Thank you for replying... we've identified the issue occurs when we create a Media Manager field with mixed case.  When we create a field that is all lower case the error does not occur and the media manager functions normally.  Everything about the templates function normally, and we can make the media manager field function correctly f it is all lower case.   We've tried different templates and repeaters and the issue always occurs if the field is mixed case.  Our environment is running PHP 7.1.17 and MariaDB 5.6.10.  We had been using mixed case fields as it made it easier to read.  The error occurs whether or not the Manager Manager field has been added to a template or not.

I'm attaching a couple screenshots.  Thank you!

Sketch.png

Sketch (1).png

  • Like 1
Link to post
Share on other sites

@Karinne Cyphers,

Thanks for the screenshots. They've helped clarify issues.

24 minutes ago, Karinne Cyphers said:

we've identified the issue occurs when we create a Media Manager field with mixed case

I suspected as much given the error MySQL was throwing.

The error itself is originating from  ProcessPageLister (a core module) which Media Manager extends and uses to fetch and display media pages. As far as I can remember, ProcessWire only allows lower case letters for field names. Going by your screenshot though, it seems this changed sometime back. 

Back to your issue, the error is a ProcessWire error and not Media Manager's.  I'm not sure whether it should be filed as a ProcessWire bug (specific to your server environment, maybe) since it now seems upper case letters are allowed in field names. I'll try and find out.

 

Edited by kongondo
  • Like 1
Link to post
Share on other sites
21 minutes ago, kongondo said:

As far as I can remember, ProcessWire only allows lower case letters for field names.

I think it has always said this:

"Use only ASCII letters (a-z A-Z), numbers (0-9) or underscores."

I think it's likely we've just always assumed lowercase only because names suggest lowercase vs labels/titles which is where you expect difference cases, spaces, special chars etc.

  • Like 1
Link to post
Share on other sites
32 minutes ago, adrian said:

I think it has always said this:

"Use only ASCII letters (a-z A-Z), numbers (0-9) or underscores."

I think it's likely we've just always assumed lowercase only because names suggest lowercase vs labels/titles which is where you expect difference cases, spaces, special chars etc.

Thanks Adrian. This got me more curious because I vaguely remember having a talk about lower case vs upper case. So, I went back and checked, all the way from 2.2 up to and including 2.7.3. It was only lower case in those versions. So, this must be a 3.x introduction.

 

  • Like 2
Link to post
Share on other sites
3 minutes ago, kongondo said:

Thanks Adrian. This got me more curious because I vaguely remember having a talk about lower case vs upper case. So, I went back and checked, all the way from 2.2 up to and including 2.7.3. It was only lower case in those versions. So, this must be a 3.x introduction.

 

Apologies - you are indeed correct.

I can't imagine why it would actually have been changed - not sure why you'd need uppercase chars in a field name, but the description of what is allowed certainly has changed.

https://github.com/ryancramerdesign/ProcessWire/blob/a210ba0b5ea67e56fef8a27a620bcfa6f96ca0b8/wire/modules/Process/ProcessField/ProcessField.module#L949

https://github.com/processwire/processwire/blob/48fe0769a4eb3d0f5b4732fd01b4b4ed8262d952/wire/modules/Process/ProcessField/ProcessField.module#L1196

  • Like 2
Link to post
Share on other sites

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By monollonom
      (once again I was surprised to see a work of mine pop up in the newsletter, this time without even listing the module on PW modules website 😅. Thx @teppo !)
      Github: https://github.com/romaincazier/FieldtypeQRCode
      Modules directory: https://processwire.com/modules/fieldtype-qrcode/
      This is a simple module I made so a client could quickly grab a QR Code of the page's url in the admin.
      There's not much to it for now, but if need be you can output anything using a hook:
      $wire->addHookAfter("FieldtypeQRCode::getQRText", function($event) { $event->return = "Your custom text"; }) You can also output the QR code on your front-end by calling the field:
      echo $page->qr_code_field; The module uses the PHP library QR Code Generator by Kazuhiko Arase. When looking for a way to generate a QR Code in PW I came across @ryan's integration in his TFA module. I'm not very familiar with fieldtype/inputfield module development so I blindly followed @bernhard (great) tutorial and his BaseFieldtypeRuntime. At some point I'll take a deeper look to make a module on my own.
      Some ideas for improvements :
      add the ability to choose what to ouput : page's url / editUrl / file(s) / image(s) / ... allow to output multiple QR codes ?
    • By Chris Bennett
      https://github.com/chrisbennett-Bene/AdminThemeTweaker
      Inspired by @bernhard's excellent work on the new customisable LESS CSS getting rolled into the core soon, I thought I would offer up the module for beta testing, if it is of interest to anyone.

      It takes a different approach to admin styling, basically using the Cascade part of CSS to over-ride default UiKit values.
      Values are stored in ModuleConfig Module creates a separate AdminThemeTweaker Folder at root, so it can link to AdminThemeTweaker.php as CSS AdminThemeTweaker.php reads the module values, constructs the CSS variables then includes the CSS framework Can be switched on and off with a click. Uninstall removes everything, thanks to bernhard's wonderful remove dir & contents function.
      It won't touch your core. It won't care if stuff is upgraded. You won't need to compile anything and you don't need to touch CSS unless you want to.

      It won't do much at all apart from read some values from your module config, work out the right CSS variables to use (auto contrast based on selected backgrounds) and throw it on your screen.
      You can configure a lot of stuff, leave it as it comes (dark and curvy), change two main colors (background and content background) or delve deep to configure custom margins, height of mastheads, and all manner of silly stuff I never use.

      Have been developing it for somewhere around 2 years now. It has been (and will continue to be) constantly tweaked over that time, as I click on something and find something else to do.
      That said, it is pretty solid and has been in constant use as my sole Admin styling option for all of those 2 years.

      If nothing else, it would be great if it can provide any assistance to @bernhard or other contributor's who may be looking to solve some of the quirkier UiKit behavior.
      Has (in my opinion) more robust and predictable handling of hidden Inputfields, data-colwidths and showIf wrappers.
      I am very keen to help out with that stuff in any way I can, though LESS (and any css frameworks/tools basically) are not my go.
      I love CSS variables and banging-rocks-together, no-dependency CSS you can write with notepad.



       

    • By opalepatrick
      I see old posts saying that repeaters are not the way to go in Custom Process Modules. If that is the case, when using forms (as I am trying to do) how would one tackle things like repeat contact fields where there can be multiple requirements for contact details with different parameters? (Like point of contact, director, etc) or even telephone numbers that have different uses?
      Just for background I am creating a process module that allows me to create types of financial applications in the admin area (no need to publish any of this, pure admin) that require a lot of personal or company information.
      Maybe I am thinking about this incorrectly?
    • By HMCB
      I ran across a reference to IftRunner module. The post was 6 years ago. I cant find it in available modules. Has it been pulled?
    • By tcnet
      PageViewStatistic for ProcessWire is a module to log page visits of the CMS. The records including some basic information like IP-address, browser, operating system, requested page and originate page. Please note that this module doesn't claim to be the best or most accurate.
      Advantages
      One of the biggest advantage is that this module doesn't require any external service like Google Analytics or similar. You don't have to modify your templates either. There is also no Javascript or image required.
      Disadvantages
      There is only one disadvantage. This module doesn't record visits if the browser loads the page from its browser cache. To prevent the browser from loading the page from its cache, add the following meta tags to the header of your page:
      <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" /> <meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="Expires" content="0" /> How to use
      The records can be accessed via the Setup-menu of the CMS backend. The first dropdown control changes the view mode.

      Detailed records
      View mode "Detailed records" shows all visits of the selected day individually with IP-address, browser, operating system, requested page and originate page. Click the update button to see new added records.

      Cached visitor records
      View modes other than "Detailed records" are cached visitor counts which will be collected on a daily basis from the detailed records. This procedure ensures a faster display even with a large number of data records. Another advantage is that the detailed records can be deleted while the cache remains. The cache can be updated manually or automatically in a specified time period. Multiple visits from the same IP address on the same day are counted as a single visitor.

      Upgrade from older versions
      Cached visitor counts is new in version 1.0.8. If you just upgraded from an older version you might expire a delay or even an error 500 if you display cached visitor counts. The reason for this is that the cache has to be created from the records. This can take longer if your database contains many records. Sometimes it might hit the maximally execution time. Don't worry about that and keep reloading the page until the cache is completely created.
      Special Feature
      PageViewStatistic for ProcessWire can record the time a visitor viewed the page. This feature is deactivated by default. To activate open the module configuration page and activate "Record view time". If activated you will find a new column "S." in the records which means the time of view in seconds. With every page request, a Javascript code is inserted directly after the <body> tag. Every time the visitor switches to another tab or closes the tab, this script reports the number of seconds the tab was visible. The initial page request is recorded only as a hyphen (-).

      Settings
      You can access the module settings by clicking the Configuration button at the bottom of the records page. The settings page is also available in the menu: Modules->Configure->ProcessPageViewStat.
      IP2Location
      This module uses the IP2Location database from: http://www.ip2location.com. This database is required to obtain the country from the IP address. IP2Location updates this database at the begin of every month. The settings of ProcessPageViewStat offers the ability to automatically download the database monthly. Please note, that automatically download will not work if your webspace doesn't allow allow_url_fopen.
      Dragscroll
      This module uses DragScroll. A JavaScript available from: http://github.com/asvd/dragscroll. Dragscroll adds the ability in view mode "Day" to drag the records horizontally with the mouse pointer.
      parseUserAgentStringClass
      This module uses the PHP class parseUserAgentStringClass available from: http://www.toms-world.org/blog/parseuseragentstring/. This class is required to filter out the browser type and operating system from the server request.
×
×
  • Create New...