Jump to content

Recommended Posts

Is there a planned release Date for the new Version with UIKit Admin Theme support?

I would like to buy the module, but without UIKit support I still have to wait 😉 

Share this post


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

Is there a planned release Date for the new Version with UIKit Admin Theme support?

I would like to buy the module, but without UIKit support I still have to wait 😉 

Hi @zoeck,

Thanks for your interest in Media Manager. I can't give a definite date but it will be in the autumn.

  • Like 2

Share this post


Link to post
Share on other sites

Hi, I recently bought the Mediamanager but I am not able to configure tagging of single media files properly. I followed the instructions on https://mediamanager.kongondo.com/documentation/getting-started/enabling-media-tags/ but no matter what option of tagging I choose ("User enters tags by text input", "User selects from list of predefined tags" or "User selects from list of predefined tags + can input their own") only the first option seems to work (entering text by myself). That is not very comfortable for the user and also kind of error prone. Are the other options just not implemented correctly or am I doing something wrong. Any help would be appreciated.

Share this post


Link to post
Share on other sites
19 minutes ago, ampersand83 said:

Hi, I recently bought the Mediamanager but I am not able to configure tagging of single media files properly.

Hi @ampersand83,

Many thanks for the purchase. Welcome to the forums as well :-).

Predefined tags in ProcessWire are relatively new. Updating Media Manager to include the feature is planned, although it may not make it in the next (soon) release.

Share this post


Link to post
Share on other sites

Just to clarify my post above, @ampersand83, my answer is in reference to bulk adding/editing tags. In the upcoming version, media will be edited in a modal in its original page. Hence, you will be able to use any tags input as normal.

Share this post


Link to post
Share on other sites
On 10/9/2018 at 12:21 PM, kongondo said:

Just to clarify my post above, @ampersand83, my answer is in reference to bulk adding/editing tags. In the upcoming version, media will be edited in a modal in its original page. Hence, you will be able to use any tags input as normal.

Thank you @kongondo  for your quick reply. That sounds nice. I really hope you will be able to release the new version this year. I'm looking forward to hopefully many improvements to that already nice module.

Share this post


Link to post
Share on other sites

Hi,

I'm new to Processwire. I've recently bought and installed Media Manager, and I have a couple of questions.

I've added Media Manager field as part of a fieldgroup which is placed in a Repeater field (for users to specify image sets for the masthead). There's a small bug in which closing the media manager Insert media dialog box will remove the new Repeater row that is added. It doesn't happen to regular images field. I've attached a video below for illustration purposes.

 

Also, is there a way to consolidate all the files under 1 directory? Most of the time we upload the files into 1 directory (example: assets/images ) and upload them through FTP and the content editors add in the files from the same directory.

 

 

 

Share this post


Link to post
Share on other sites

Hi @Nekorin,

On 11/7/2018 at 3:57 AM, Nekorin said:

I'm new to Processwire.

Welcome to ProcessWire and the forum 🙂

On 11/7/2018 at 3:57 AM, Nekorin said:

I've recently bought and installed Media Manager

Many thanks for the purchase.

On 11/7/2018 at 3:57 AM, Nekorin said:

There's a small bug in which closing the media manager Insert media dialog box will remove the new Repeater row that is added.

Thanks for reporting this. I'll have a look. I couldn't see this happening in your illustration video though; must have missed it :-).

On 11/7/2018 at 3:57 AM, Nekorin said:

Also, is there a way to consolidate all the files under 1 directory? Most of the time we upload the files into 1 directory (example: assets/images ) and upload them through FTP and the content editors add in the files from the same directory.

I'm not sure I follow completely. You are able to FTP files into the directory /sites/assets/MediaManager/uploads/. You can then use the scan feature in the uploads dashboard to move the files to the Media Manager library. The main purpose of Media Manager is to create one large, central bucket for all your media. Content editors should then be able to pick any of the images in Media Manager to use in any page. Please let me know if I misunderstood your request.

Share this post


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

Thanks for reporting this. I'll have a look. I couldn't see this happening in your illustration video though; must have missed it :-).

Sorry that the previous video doesn't depict what I was doing correctly and might have caused some confusion. Below is a more accurate representation of what it is about. Basically whenever I add a new row and insert a media element with the media manager, upon closing the media manager dialog window, it 'erases' all the repeater/repeater_matrix rows for the entire page. I'll have to add back all the rows (it kind of makes it a bit annoying to use. Although I can get it to save in the end, I'll have to do it 25 times if the masthead carousel has 5 rotating images). 

 

There is a JS error too when I access media manager or add an image. 

image.thumb.png.9ae616177be72deeebb456fad963e7f1.png

 

5 hours ago, kongondo said:

I'm not sure I follow completely. You are able to FTP files into the directory /sites/assets/MediaManager/uploads/. You can then use the scan feature in the uploads dashboard to move the files to the Media Manager library. The main purpose of Media Manager is to create one large, central bucket for all your media. Content editors should then be able to pick any of the images in Media Manager to use in any page. Please let me know if I misunderstood your request.

Thanks for the tips. What i'm referring to is after scanning, each individual image is placed in its own separate folder with an id as the folder name. Is there any way to keep everything within a single folder after scanning? It is tedious to make changes to images, can't just ftp them in and see the changes reflected immediately on the frontend. 

Does scan have an overwrite existing files function?

Share this post


Link to post
Share on other sites

Hey @kongondo,

I just purchased your media manager module, thank you for providing it. As far as I can see it works, but it looks broken with AdminThemeUiKit. When I bought it I was expecting it to look like in the screenshots. Now I don't want to show it to the client like that. Do you have a V12-beta I can use?

Also when I upload mp4 videos I get an error saying "filetype not allowed", although mp4 is in the list of allowed extensions. Is this aknown error?

Share this post


Link to post
Share on other sites

Hi @Youbility,

First, please accept my apologies for not getting back to you earlier. I've had some serious computer issues that have set me back a couple of weeks. I hope to be back to 'normal' by the end of this week.

On 11/9/2018 at 11:40 AM, Youbility said:

I just purchased your media manager module, thank you for providing it

Many thanks for your purchase.

 

On 11/9/2018 at 11:40 AM, Youbility said:

When I bought it I was expecting it to look like in the screenshots.

I think you saw the screenshots for the upcoming beta version. Its release has now also been delayed (some unforseen bugs, etc). The current version is not compatible with UIKit. The beta version is not production ready too. 

 

On 11/9/2018 at 11:40 AM, Youbility said:

 Now I don't want to show it to the client like that. Do you have a V12-beta I can use?

This is totally understandable. How would you like to proceed? The beta version may not be out soon. If using an older admin theme, e.g. Reno, is out of the question, then the only option left is not to use Media Manager until the new version is out. I'm happy to offer a refund if you'd rather not wait for the new version. Please do let me know.

Thanks.

Share this post


Link to post
Share on other sites
On 11/9/2018 at 2:30 AM, Nekorin said:

a JS error too when I access media manager or add an image. 

Yes. This has been fixed in the upcoming version. The bug had to do with satisfying some ProcessLister requirement.

On 11/9/2018 at 2:30 AM, Nekorin said:

after scanning, each individual image is placed in its own separate folder with an id as the folder name.

Behind the scenes each image is a page in ProcessWire. That's why you see this. The ID is the id of the page with the media.

On 11/9/2018 at 2:30 AM, Nekorin said:

Is there any way to keep everything within a single folder after scanning?

Currently no, but sounds like an idea/feature request to consider. Maybe a checkbox or a pattern to detect if images should be kept together e.g. house-1.jpg, house-2.jpg, etc. The upcoming version of Media Manager allows to add images to an existing media page. 

On 11/9/2018 at 2:30 AM, Nekorin said:

It is tedious to make changes to images,

What sort of changes are these? Changing the images? Cropping? Other?

On 11/9/2018 at 2:30 AM, Nekorin said:

Does scan have an overwrite existing files function?

No. I'll see if I can add this. Yes, it does. it respects your media manager settings. The settings apply across board. Sorry for the erroneous info.

Edited by kongondo
Misleading info

Share this post


Link to post
Share on other sites
On 11/9/2018 at 11:40 AM, Youbility said:

I get an error saying "filetype not allowed", although mp4 is in the list of allowed extensions. Is this aknown error?

That would only happen if the MIME type of the video is some other format not recognised by the system. Are you able to check the MIME type and let me know? If not, I can send you some code to help.

Share this post


Link to post
Share on other sites

Hello @kongondo

 

Our users are getting the error "Empty file upload result" when trying to upload images, documents etc...

649332669_Bildschirmfoto2018-11-29um10_07_19.thumb.png.8759fdf87a0f987cb7c7c3c6fe7aa04f.png

 

But the image still gets uploaded successfully.

424296831_Bildschirmfoto2018-11-29um10_08_05.png.a49778b335b0c1f221bd6e7b95728fed.png

 

 

After that i checked with Chrome dev tools the ajax response when uploading the placeholder image:

I get this error:

1630049281_Bildschirmfoto2018-11-29um10_22_44.thumb.png.86c9ec94b81d90ce5528c9198470c407.png

 

I searched for that page "peter-fractures-lac-37499" but only found the page "peter-fractures-lac". But it is a media manager audio page.

378183065_Bildschirmfoto2018-11-29um10_36_10.thumb.png.299585fb3491131424e33aae86548a2d.png

 

It looks like the module is trying to create a new mm-audio page called "peter-fractures-lac" but since there is already a page with the same name this error happens.

But the question is why is he trying to create a audio page when I am uploading an image?

 

Processwire Version: 2.7.3 dev

MediaManager Version: 0.0.9

JqueryFileUpload Version: 0.0.2

PHP-Version: 7.0.32

 

Kind Regards

Orkun

Share this post


Link to post
Share on other sites

Hi @Orkun,

You say this is happening with all media types you try to upload? That's strange. I think I've experienced this once when Media Manager was not installed properly and every created child (media page) was heading to the first available media parent, and that happens to be 'Audio'. 

  • Is this a fresh install? Or has Media Manager on that site been working OK previously?
  • Is it possible to have a copy of the images and any non-sensitive documents you are trying to upload so that I can debug?
  • Clearing cache several times and deleting the offending 
  • Is reinstalling Media Manager and option? Does that help? Any errors?
  • We've previously had a similar problem with Imagick but I'm not sure whether that's the case.
By the way, JqueryFileUpload Version: 0.0.2 is a bit outdated :-). Grab the latest version if you can.
 
Thanks.

Share this post


Link to post
Share on other sites

Hi @kongondo

Sorry for my late answer. I could resolve the issue with renaming the audio pagename from "peter-fractures-lac" to "peter-fractures-lac-old" after I have done that somehow a new page was generated automatically called "peter-fractures-lac" with the same audio file like the "old" page ("peter-fractures-lac-old"). From now on I could upload images documents etc... and it worked fine. The Error "Empty file upload result" doesn't come anymore. I also removed now the new generated audio page and renamed "peter-fractures-lac-old" back to "peter-fractures-lac" and everything still works fine. Very strange behavior.

Quote

Is this a fresh install? Or has Media Manager on that site been working OK previously?

- It was working OK previously

 

Quote

By the way, JqueryFileUpload Version: 0.0.2 is a bit outdated :-). Grab the latest version if you can.

I upgraded to 0.0.6 now. Thanks.

 

Kind Regards
Orkun

  • Like 1

Share this post


Link to post
Share on other sites

Hi @kongondo,

I have a proposal for a future version of MediaManager: There are other CMS, where you can preset a internal or external link for each media object. Would this be a useful feature in MediaManager, too?

Greetings,

Thomas.

Share this post


Link to post
Share on other sites
1 hour ago, xportde said:

There are other CMS, where you can preset a internal or external link for each media object. Would this be a useful feature in MediaManager, too?

Hi @xportde,

It would be and it doesn't need to wait for the future. It is already here 🙂. With the new version (announcement imminent), you can add as many fields as you want to your respective Media Manager templates. Let's say you want a URL for your images. All you would need is to:

  1. Add a URL field (in this example, called link) to the Media Manager image template (media-manager-image). 
  2. If not accessing your Media Manager Library directly, create a Media Manager Field (let's call it albums) and add it to your page's template, say basic-page. In the Media Manager Field (albums) settings, enable 'Allow users to edit selected media'. 
  3. Edit a page using basic-page template.
  4. Add images to the field 
  5. Hover over an image and click the Edit link. 
  6. Edit your link field to add your URL. 
  7. In your template file, you can access your URL like this:

 

$albums = $page->albums;
$out = '<div>';
$out .= $albums->each(function($m) {
    if($m->typeLabel !='image') return;
    $thumb = $m->media->height(260);
    $img = "<img src='{$thumb->url}' alt='{$m->media->description}' height='130'>";
    $o = "<div><a href='$m->links'>$img</a></div>";
    return $o;
  });
$out .= '</div>';

// OR: Using foreach
/*
$out = '<div>';
foreach ($albums as $a) {
    if($m->typeLabel !='image') return;
    $thumb = $m->media->height(260);
    $img = "<img src='{$thumb->url}' alt='{$m->media->description}' height='130'>";
    $out .= "<div><a href='$m->links'>$img</a></div>";
    $out .= $m->body;
}

$out .= '</div>';
*/
echo $out;

 

And that's it. Any field you add to your Media Manager template is available as $m->name_of_field, where $m is an instance of MediaManager field as per the example above. More examples in my next (eventual) post(s).

I tried to make a video, or an animated GIF, even a simple screen capture to show you what I mean but everything failed! Lots of artefacts, etc. I've recently moved to Linux, so still finding my way round. 

 

Share this post


Link to post
Share on other sites

Beta testers needed 😃. Please send me a PM if you'd like to help. An active subscription/current license is required.

I'm happy (and frankly relieved 😁) to announce Media Manager v 012 is ready for beta testing. Please accept my apologies for the delay. 

 

With this version:

  1. Only ProcessWire 3.x (preferably the latest master) is supported from now on.
  2. Currently, only AdminThemeUiKit is supported. (we may support Reno theme in the future).

 

Changelog

 

ProcessMediaManager (Media Manager Library/back-end)

  1. New UI: Responsive and closely matches ProcessWire theme (UiKit)

  2. Media thumbs shown in their natural orientation

  3. Upload Anywhere: Upload directly to Media Manager Library using drag and drop

  4. New edit media page in modal (natural ProcessWire page) (respects locked status and Media Manager edit permission if present)

  5. Create image variations in natural ProcessWire page during editing

  6. Add, edit, display and access custom ‘columns’ (fields) added to media manager templates (e.g. add text field to media-manager-image and access value using Media Manager API)

  7. Hide media types menu items if media type not in use

  8. Global setting for allowed media types (e.g. image and video only)

  9. Hide ‘All’ menu item

  10. New filters dashboard

  11. Updated and freshened up upload’s dashboard

  12. Option to upload ZIP archives as is (to save as documents) vs. to decompress them (recursively)

  13. Preview PDF documents in ‘gallery mode’ (if browser supports it)

  14. Selection of media is now identical to how images thumbs are selected in ProcessWire

 

media-manager-edit-1.thumb.png.b5c09ee5ab27f3e23fa505703604a911.png

 

media-manager-edit-2.thumb.png.7a69dd02fac3fe4cef7e753f2af9c9b1.png

 

media-manager-select-media-1.thumb.png.92090c92959cf5f77f024f7870f578e9.png

 

media-manager-select-media-2.thumb.png.2ea01a2274f8f69343ad6d978ce8a0f9.png

 

media-manager-tags-1.thumb.png.286d68e6e9d96af93847378bc807abf1.png

 

media-manager-tags-2.thumb.png.ee33eaf848b55156ea4d6f214e74a780.png

 

media-manager-upload-anywhere-1.thumb.png.d1f77f4440cc15e742cad604d09dacfd.png

 

media-manager-uploads-add-1.thumb.png.cd6d2532323ad124e897368670650abd.png

 

media-manager-uploads-add-2.thumb.png.e23432b6915353b4b8d4e2de982b209e.png

 

media-manager-uploads-scan-1.thumb.png.36cb1c85db85ab8b27355fcd9dc33603.png

 

media-manager-filters-1.thumb.png.4c93ca42d7ba13c4954ca9e8b9505e61.png

 

media-manager-filters-2.thumb.png.6beeb947eb7165f4e2dfe9bfcb52d37e.png

 

media-manager-settings-custom-columns-1.thumb.png.fa8917406e55334124b66b85d5ea2db0.png

 

media-manager-settings-more-new-1.thumb.png.b2e5b240d162adcd2dde1ba054369202.png

 

FieldtypeMediaManager

  1. Enable Upload Anywhere (for InputfieldMediaManager use)

  2. Allow users to edit media displayed in a Media Manager Inputfield

  3. Change whether to use text or icons for action ‘buttons’

  4. Custom fields: Display and edit ‘columns’ (fields) added to media manager templates

 

media-manager-field-settings-1.thumb.png.6148135c4a576cb4fcbe33f6d08031b5.png

 

media-manager-field-settings-2.thumb.png.30d210db2fdf1f8de6e5b026e2b44107.png

 

InputfieldMediaManager

  1. New UI: Responsive and closely matches ProcessWire theme (UiKit)

  2. Media thumbs shown in their natural orientation

  3. Upload Anywhere: Upload directly to Media Manager Library using drag and drop AND simultaneously insert into the Media Manager field on the page being edited

  4. Inputfield Media Manager markup updated/refreshed using Ajax when media is added or edited. No need for a page reload (so you won’t lose unsaved changes on the page)

  5. New edit media page in modal (natural ProcessWire page) (respects locked status and Media Manager edit permission if present)

  6. If a media in a Media Manager Inputfield is unpublished or trashed, it is automatically removed from all Media Manager Inputfields present on the page (including its variations) and the fields refreshed using Ajax

  7. View values of custom columns (not all Fieldtypes supported for viewing although all supported for accessing using the API). These are refreshed on the Inputfield using Ajax once editing is complete.

  8. Better support for repeaters

  9. Preview PDF documents in ‘gallery mode’ (if browser supports it)

  10. Selection of media is now identical to how images thumbs are selected in ProcessWire

 

media-manager-inputfield-1.thumb.png.c3f356f72a140774c1eabbaa829b2f02.png

 

media-manager-inputfield-2.thumb.png.57f86a0296623ce95633049a742feb26.png

 

media-manager-inputfield-upload-anywhere-1.thumb.png.4973a98dce29d8c56361ab41bdb01d4e.png

 

media-manager-inputfield-upload-anywhere.thumb.gif.da6d7a953a1dd8f6124922fc4f17ccc5.gif

 

 

1901912334_media-manager-inputfield-upload-anywhereunzipping.thumb.gif.5ebb9657fcd0ec149167ac80572a8a93.gif

 

media-manager-pdf-preview.thumb.gif.9bfb103ab4b3a6994d5aa0ab309e4423.gif

 

Inserting image variations

media-manager-inputfield-insert-variations-1.thumb.png.4d4cd09f47f95d04a28f2d6a431b1aed.png

 

media-manager-inputfield-insert-variations-2.thumb.png.9717c1e0baf4107409aa49eca13dc165.png

 

Media Manager API (working in the front-end and manipulation via the API)

  1. Access media in a Media Manager field on a given page (see examples below)

In the example below, we access custom fields (columns) added to the image media template (media-manager-image). In this case, two fields have been added. A URL field named links and a text field called headline. You can add any field you want. Please note though that not all fields can be displayed in the backend (for practicality). In the frontend, there are no such restrictions and you can access any of the fields as shown below. Your MediaManager object gives you access to the fields. For instance:

$m->name_of_your_field. 
Below, we have 
$m->links and $m->headline.

 

Please note that $m->media still returns the first media in the MediaManager object. In case you have added more than one media to your media field, e.g. more than one image added to one MediaManager object (done via editing a Media), you can access all of them using:

$m->mediaField;

In the case of image media, $m->mediaField returns a Pageimages object which can be iterated. This assumes, of course, that your media_manager_image field accepts more than one image (the default).

The default setting for number of files accepted for other media types is 1, hence $m->mediaField returns a Pagefile object. You can edit these fields (media_manager_audio, media_manager_document and media_manager_video) to accept multiple files is you wish, in which case $m->mediaField will return a Pagefiles object which you can loop through, access using first(), last(), eq(n), etc.

 

// get the media manager field on the page
$mediaContent = $page->media_manager_tests;

$tbody = '<tbody>';
$tbody .= $mediaContent->each(function($m) {
    if($m->typeLabel !='image') return;
	$thumb = $m->media->height(130);
    $img = "<img src='{$thumb->url}' alt='{$m->media->description}' height='130'>";
	$tds =
		"<td>$img</td>" .
		"<td>{$m->headline}</td>" .
		"<td><a href='{$m->links}'>{$m->title}</a></td>";

	$row = "<tr>{$tds}</tr>";
    return $row;
});
$tbody .= '</tbody>';

$content .=
	"<div class='uk-overflow-auto uk-width-1-1'>".
		"<table id='news-outlets' role='presentation' class='uk-table uk-table-divider uk-table-hover uk-table-justify uk-table uk-table-middle uk-table-responsive'>".
			"<thead>" .
				"<tr>" .
					"<th class='uk-width-small'>Preview</th>" .
					"<th class='uk-table-expand'>Summary</th>" .
					"<th class='uk-width-medium'>Link</th>" .
				"</tr>" .
			"</thead>" .
			"{$tbody}".
	"</table></div>";

 

Output of the above code

media-manager-api-output-1.thumb.png.aac5a7285b355bd7deaf8b78b245438c.png

 

media-manager-api-output-2.thumb.png.af279330ea44dc6e8bdd49607d34b6f6.png

 

 

  • Like 5

Share this post


Link to post
Share on other sites

Hi,

i have trouble getting images resized in the listerPro module from Ryan. He asks if the MediaManager module implements the markupValue() method?!

To clarify in The listerPro module can list fields such as images of records. in order to produce a nice list / table it can resize the images on the fly ... thumbnails of 80x80 or what ever setting you whish.

In my setup this is not working (mediamanager field, single instance, only image allowed) and Ryan suggests the markupValue() is probably not implemented.

I my self thought there might be an abstraction depth problem as on the normal imagefield one interacts with the field. In the mediamanager one interacts with the $field->media object ... one level down ...

Share this post


Link to post
Share on other sites

Hi @besrwordt,

Welcome to the forums. 

12 hours ago, besrwordt said:

He asks if the MediaManager module implements the markupValue() method?

Currently, no.

12 hours ago, besrwordt said:

In my setup this is not working (mediamanager field, single instance, only image allowed) and Ryan suggests the markupValue() is probably not implemented.

I'll look into this. What versions of MM and PW are you using?

Share this post


Link to post
Share on other sites
11 minutes ago, kongondo said:

Hi @besrwordt,

Welcome to the forums. 

Currently, no.

I'll look into this. What versions of MM and PW are you using?

Hi @kongondo, PW is 3.0.98 MM is 0.1.1 and ListerPro is 1.1.1

Thanks!

Share this post


Link to post
Share on other sites

@kongondo Another thing: how would i go about to merge 2 mediamanager fields via API... if i add the media from one field to another i get the Class 'MediaManagerArray' doesn't yet implement method 'makeBlankItem() error ...

            foreach ($page->mm-field->media as $t-media ){
                $_another_mmmedia_field.=$t-media;
            }

...

 

Share this post


Link to post
Share on other sites

@besrwordt,

Do you have a current Media Manager subscription? makeBlankItem() is implemented in the latest Media Manager (version 012, soon coming out of beta). However, you can still import from one MM field to another. A MM field behaves like PageArrays (WireArrays). 

 

A Media Manager field stores only two pieces of data; the (page) ID of the media being referenced and the media type (1=audio; 2=document; 3=image; 4=video; 3x=image variation). There's two ways you can go about exporting/importing from one field to the other. The second way is easiest if you need to import everything from one field to another, no questions asked. The first method allows fine control, e.g. if you want to skip certain media types. In the examples below, media_export is the Media Manager field with the media you want to copy over/merge with a second Media Manager field. media_import is the second Media Manager field into which media is being imported/copied over.

Method One: Loop through each media in the Media Manager field you are exporting from

// page with mm field we are importing into (media_import)
$p = $pages->get(1234);

// page with mm field we are exporting from (media_export)
foreach ($page->media_export as $m ) {
    // @note: here you can skip media you don't want to export
    // instance of new MediaManager()
    $mm = new MediaManager();
    // populate the MediaManager object properties with required data (media id and type)
    $mm->id = $m->id;
    $mm->type = $m->type;
    // import/add the media to the 2nd mm field (media_import)
    $p->media_import->add($mm);
}

// output formatting of
$p->of(false);
// save only the media manager field (page with import mm field)
$p->save('media_import');
// revert output formatting back on
$p->of(true);

 

Method Two: Import everything at once

// page with mm field we are importing into (media_import)
$p = $pages->get(1234);
// import all the media in the 1st mm field (media_export) into the 2nd mm field (media_import)
$p->media_import->import($page->media_export);
// output formatting of
$p->of(false);
// save only the media manager field (page with import mm field)
$p->save('media_import');
// revert output formatting back on
$p->of(true);

 

Note that all WireArray behaviour apply. For instance, you might want to first experiment in cases where your 2nd Media Manager field (media_import) already has some media which may or may not be present in the first Media Manager field. 

 

Share this post


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 robert
      I often had the need for an overview of all used fields and their contents for a specific page/template while developing new websites without switching to the backend, so I made a small module which lists all the needed information in a readable manner (at least for me):
      Debug Page Fields
      https://github.com/robertweiss/ProcessDebugPageFields
      It adds two new properties to all pages:
      $page->debugFieldValues – returns an object with all (sub-)fields, their labels, fieldtypes and values $page->debugFieldTypes – returns an object with all fieldtypes and their corresponding fields // List all values of a pages $page->debugFieldValues // List a specific field $page->debugFieldValues->fieldname // List all used fieldtypes of a page $page->debugFieldTypes I recommend using it in combination with Tracy Debugger, Ray, Xdebug etc. as it returns an object and is only meant for developing/debugging uses. 
      For now, the fieldtype support includes mostly fieldtypes I use in my projects, but can easily be extended by adding a new FieldtypeFIELDNAME method to the module. I use it with five different client installations (all PW 3.0.*), but of course there might be some (or more) field configurations which are not covered correctly yet.
      Supported fieldtypes
      Button Checkbox Color Combo Datetime Email FieldsetPage * File FontIconPicker Functional Image ImageReference MapMarker Multiplier Mystique Options Page PageIDs PageTitle Radio Repeater * RepeaterMatrix * RockAwesome SeoMaestro Table Text Textarea Textareas Toggle URL * The fields with complete subfield-support also list their corresponding subfields.
      Installation
      Download the zip file at Github or clone the repo into your site/modules directory. If you downloaded the zip file, extract it in your sites/modules directory. In your admin, go to Modules > Refresh, then Modules > New, then click on the Install button for this module. As this is my first ›public‹ module, I hope I did not miss any important things to mention here.
    • By horst
      Wire Mail SMTP

      An extension to the (new) WireMail base class that uses SMTP-transport

      This module integrates EmailMessage, SMTP and SASL php-libraries from Manuel Lemos into ProcessWire. I use this continously evolved libraries for about 10 years now and there was never a reason or occasion not to do so. I use it nearly every day in my office for automated composing and sending personalized messages with attachments, requests for Disposition Notifications, etc. Also I have used it for sending personalized Bulkmails many times.

      The WireMailSmtp module extends the new email-related WireMail base class introduced in ProcessWire 2.4.1 (while this writing, the dev-branch only).
       
      Here are Ryans announcement.



      Current Version 0.6.0
      Changelog: https://github.com/horst-n/WireMailSmtp/blob/master/CHANGELOG.md
      get it from the Modules Directory Install and Configure

      Download the module into your site/modules/ directory and install it.

      In the config page you fill in settings for the SMTP server and optionaly the (default) sender, like email address, name and signature.
      You can test the smtp settings directly there. If it says "SUCCESS! SMTP settings appear to work correctly." you are ready to start using it in templates, modules or bootstrap scripts.


      Usage Examples
      The simplest way to use it:
      $numSent = wireMail($to, $from, $subject, $textBody); $numSent = wireMail($to, '', $subject, $textBody); // or with a default sender emailaddress on config page This will send a plain text message to each recipient.
       
      You may also use the object oriented style:
      $mail = wireMail(); // calling an empty wireMail() returns a wireMail object $mail->to($toEmail, $toName); $mail->from = $yourEmailaddress; // if you don't have set a default sender in config // or if you want to override that $mail->subject($subject); $mail->body($textBody); $numSent = $mail->send(); Or chained, like everywhere in ProcessWire:
      $mail = wireMail(); $numSent = $mail->to($toEmail)->subject($subject)->body($textBody)->send(); Additionaly to the basics there are more options available with WireMailSmtp. The main difference compared to the WireMail BaseClass is the sendSingle option. With it you can set only one To-Recipient but additional CC-Recipients.
      $mail = wireMail(); $mail->sendSingle(true)->to($toEmail, $toName)->cc(array('person1@example.com', 'person2@example.com', 'person3@example.com')); $numSent = $mail->subject($subject)->body($textBody)->send(); The same as function call with options array:
      $options = array( 'sendSingle' => true, 'cc' => array('person1@example.com', 'person2@example.com', 'person3@example.com') ); $numSent = wireMail($to, '', $subject, $textBody, $options); There are methods to your disposal to check if you have the right WireMail-Class and if the SMTP-settings are working:
      $mail = wireMail(); if($mail->className != 'WireMailSmtp') { // Uups, wrong WireMail-Class: do something to inform the user and quit echo "<p>Couldn't get the right WireMail-Module (WireMailSmtp). found: {$mail->className}</p>"; return; } if(!$mail->testConnection()) { // Connection not working: echo "<p>Couldn't connect to the SMTP server. Please check the {$mail->className} modules config settings!</p>"; return; }  
      A MORE ADVANCED DEBUG METHOD!
      You can add some debug code into a template file and call a page with it:
      $to = array('me@example.com'); $subject = 'Wiremail-SMTP Test ' . date('H:i:s') . ' äöü ÄÖÜ ß'; $mail = wireMail(); if($mail->className != 'WireMailSmtp') { echo "<p>Couldn't get the right WireMail-Module (WireMailSmtp). found: {$mail->className}</p>"; } else { $mail->from = '--INSERT YOUR SENDER ADDRESS HERE --'; // <--- !!!! $mail->to($to); $mail->subject($subject); $mail->sendSingle(true); $mail->body("Titel\n\ntext text TEXT text text\n"); $mail->bodyHTML("<h1>Titel</h1><p>text text <strong>TEXT</strong> text text</p>"); $dump = $mail->debugSend(1); } So, in short, instead of using $mail->send(), use $mail->debugSend(1) to get output on a frontend testpage.
      The output is PRE formatted and contains the areas: SETTINGS, RESULT, ERRORS and a complete debuglog of the server connection, like this one:
       
      Following are a ...


      List of all options and features


      testConnection () - returns true on success, false on failures


      sendSingle ( true | false ) - default is false

      sendBulk ( true | false ) - default is false, Set this to true if you have lots of recipients (50+)


      to ($recipients) - one emailaddress or array with multiple emailaddresses

      cc ($recipients) - only available with mode sendSingle, one emailaddress or array with multiple emailaddresses

      bcc ($recipients) - one emailaddress or array with multiple emailaddresses

       
      from = 'person@example.com' - emailaddress, can be set in module config (called Sender Emailaddress) but it can be overwritten here

      fromName = 'Name Surname' - optional, can be set in module config (called Sender Name) but it can be overwritten here


      priority (3) - 1 = Highest | 2 = High | 3 = Normal | 4 = Low | 5 = Lowest

      dispositionNotification () or notification () - request a Disposition Notification


      subject ($subject) - subject of the message

      body ($textBody) - use this one alone to create and send plainText emailmessages

      bodyHTML ($htmlBody) - use this to create a Multipart Alternative Emailmessage (containing a HTML-Part and a Plaintext-Part as fallback)

      addSignature ( true | false ) - the default-behave is selectable in config screen, this can be overridden here
      (only available if a signature is defined in the config screen)

      attachment ($filename, $alternativeBasename = "") - add attachment file, optionally alternative basename


      send () - send the message(s) and return number of successful sent messages


      debugSend(1) - returns and / or outputs a (pre formatted) dump that contains the areas: SETTINGS, RESULT, ERRORS and a complete debuglog of the server connection. (See above the example code under ADVANCED DEBUG METHOD for further instructions!)


      getResult () - returns a dump (array) with all recipients (to, cc, bcc) and settings you have selected with the message, the message subject and body, and lists of successfull addresses and failed addresses,


      logActivity ($logmessage) - you may log success if you want

      logError ($logmessage) - you may log warnings, too. - Errors are logged automaticaly
       
       
      useSentLog (true | false) - intended for usage with e.g. third party newsletter modules - tells the send() method to make usage of the sentLog-methods - the following three sentLog methods are hookable, e.g. if you don't want log into files you may provide your own storage, or add additional functionality here

      sentLogReset ()  - starts a new LogSession - Best usage would be interactively once when setting up a new Newsletter

      sentLogGet ()  - is called automaticly within the send() method - returns an array containing all previously used emailaddresses

      sentLogAdd ($emailaddress)  - is called automaticly within the send() method
      Changelog: https://github.com/horst-n/WireMailSmtp/blob/master/CHANGELOG.md
       
       
    • By Cybermano
      Food Allergens Module
      A simple List of Food Allergens
      My needs were to provide a simple list of food allergens for our clients with restaurant related activity.
      The idea was to simply output the list (to speed up the data entry) without leaving the food menu editing, eg. opening another page in new tab or window.
      This isn't a perfect solution, but it works fine for my needs and I decided to share the base idea.
      This could also be easily used to show little notes or short "vademecum", not only for the list of food allergens.
      ---
      Main features
      The basis
      All moves from a short editing of the module in this tutorial: How to create custom admin pages by @bernhard
      First of all it creates an empty admin page, with a dedicated permission to let safe-user to see it (this permission has to be created as a new ones, manually or by the module).
      Once the page is created, I have hooked its behaviour into the ready.php, to show the content (basically a list).
      A step further
      With the tips of  @bernhard, @Soma (and many others), see here , the magic happens. 
      The new page will be shown as a panel, so editors will not abandon their data entry to have a quick view to the list.
      A little further
      Why scroll to the top of the page to click a link?
      The next step was to create a sticky button only in the food menu pages.
      Again with a @bernhard tip I moved into the customization of this simple module and the related hook.
      ---
      How to use this module
      After installed, it creates the page /admin/page/allergens/ and the module is to be setted up. The first field is a CKEditor with multi-language. This is the place where to write the informations that will be shown into the page. The next field is a simply text-area where to place a bit of JS that will be appended to the markup of the text (omit the 'script' tags). I also putted a checkbox with a silly statement: this to think at least twice on the safety of the written JS. Now comes the first way to display the link to the page
      Field Note with Link. Enable and save it. The module will display a new row with 4 selects (1 standard and 3 ASM):
      View mode (to show the page as Panel or as Modal PopUp); Templates to select: select one or more and save before proceed, so the  asm-select of the pages will be populated showing all the pages of the selected templates. Pages to select: also here select at least one and save before proceed to populate the asm-select for fields only with the ones that belong to the selected pages. Select the fields where to place the note and save again. That's all: now you will find into the notes of the selected fields the link "See the List of Allergens".
      At the same way, the option for the sticky button, but with a plus
      The field select is obviously unnecessary, but you could play with the last row: the inline styles to fix your sticky button where you like. Here you could set the sticky position of the <div> and the absolute ones of the <a>.

      Video Explanation
      In these screencasts you could see a custom JS that show a "copy" button near a "hanna-code" call.
      This because I've set a specific one for each allergen to show up a tooltip in the front end.

      Registrazione #33.mp4  

      Registrazione #34.mp4 ---
      Last but not the least
      Actually it works fine for my needs, even if it's much improvable: I'm working on the permissions creation, the uninstall section, a separate configs and defaults and how to include the hook into the module leaving free the ready.php. According to a simpler uninstall. Also I would make the link text as a dynamic text field, so it will be more flexible.
      I always learn a lot here, so I would share my code for whom it could be interested.
      I removed the hanna code references, but I provide you the html list of the allergens, English and Italian too, so you can paste them into the "source" of the CKEditor field to have a ready to use module.
      Obviously you are free to modify the code as per your needs.
      Please, keep in mind that I'm not a pro coder and I beg your pardon for my verbosity (speaking and coding). 😉
      I hope be helpful or for inspiration.
      Bye
      ready.phpList-ITA.htmlList-ENG.htmlAllergens.module
      README.md
    • By Robin S
      This module is sort of an upgrade to my earlier ImageToMarkdown module, and might be useful to anyone working with Markdown in ProcessWire.
      Copy Markdown
      Adds icons to images and files that allow you to copy a Markdown string to the clipboard. When you click the icon a message at the top left of the screen notifies you that the copying has occurred.
      Screencast

      Note: in the screencast an EasyMDE inputfield is used to preview the Markdown. It's not required to use EasyMDE - an ordinary textarea field could be used.
      Usage: Images
      When you hover on an item in an Images field an asterisk icon appears on the thumbnail. Click the icon to copy an image Markdown string to clipboard. If the "Description" field is populated it is used as the alt text.
      You can also open the "Variations" modal for an image and click the asterisk icon to copy an image Markdown string for an individual variation.
      Usage: Files
      When you hover on an item in a Files field an asterisk icon appears next to the filename. Click the icon to copy a link Markdown string to the clipboard. If the "Description" field is populated it is used as the link text, otherwise the filename is used.
       
      https://github.com/Toutouwai/CopyMarkdown
      https://processwire.com/modules/copy-markdown/
    • By BitPoet
      I've realized that I've been jumping back and forth between the PW API docs and the source code for site modules far too much. The idea to hold all necessary documentation locally in one place has occurred to me before, but getting PHPDocumentor et al set up and running reliably (and producing readable output) as always been too much of a hassle. Today I was asked how I find the right hooks and their arguments, and that inspired me to finally get my backside down on the chair and whip something up, namely the
      Module Api Doc Viewer
      ProcessModuleApiDoc
      It lets you browse the inline documentation and public (optionally also protected) class/method/property information for all modules, core classes and template files in the ProcessWire instance. The documentation is generated on the fly, so you don't have to remember to update your docs whenever you update a module.
      The module is quite fresh, so expect some bugs there. Behind the scenes it uses PHP-Parser together with a custom class that extracts the information I needed, and the core TextformatterMarkdownExtra module for rendering the description part in the phpdoc style comments.
      This is not a replacement / competitor to the API Viewer included in the commercial ProDevTools package. There is quite some information included in the inline documentation that my module can't (and won't) parse, but which makes up parts of the official ProcessWire API docs.
      This, instead, is a kind of Swiss army knife to view PHPDoc style information and get a quick class or function reference.
      If you feel daring and want to give it a spin, or if you just want to read a bit more, visit the module's GitHub repository.
      This is the overview page under "Setup" -> "Module API Docs":

      And this is what the documentation for an individual class looks like:

      The core module documentation can of course be found online, but it didn't make sense not to include them.
      Let me know what you think!

×
×
  • Create New...