Jump to content

Media Manager Archive


kongondo

Recommended Posts

On 5/11/2023 at 1:50 PM, Boost said:

Hei,

Is it only me or the ProcessMediaManager by @kongondo doesn't install on the latest PW? I'm getting this error:


1956687108_Screenshotfrom2023-05-1114-48-19.png.6415261326b0c1a0485ff5d0cad58830.png

Hi @Boost,

Are you able to install other modules by uploading their zip files? If not, I am thinking is a permissions issue in your system?

Link to comment
Share on other sites

4 hours ago, fruid said:

not sure if this has been asked before, is there a way to filter the media by the page that they are used on?

Hi @fruid,

Do you mean when viewing the media in Media Manager? If yes, that is not currently possible. What's your use case? I'll have a think about this.

Link to comment
Share on other sites

15 hours ago, kongondo said:

Do you mean when viewing the media in Media Manager? If yes, that is not currently possible. What's your use case? I'll have a think about this.

We have different pages using the same images, that's why I wanted to give MM a try. Now there's unfortunately no possibility to have any structure in the MM – other than the type of media – but no subfolders, no parents. So I thought, if I could just filter/search an image by the page that it is already used in, that would be a work-around. I would just upload the image at the input field of the first page I want to use it in directly and for the other pages find the images by the title of the page where I uploaded it. But you cannot do that either. All I can do is filter the name of the image which is kind of a drag because our naming convention is quite messy and we migrate from a different CMS.

Link to comment
Share on other sites

2 hours ago, fruid said:

Now there's unfortunately no possibility to have any structure in the MM

@fruid,

True. This is planned for the next version of MM (see this post). I'll post a demo of it here later today. There is no firm ETA for its release but it will be after summer most likely.

Link to comment
Share on other sites

I just uploaded 800+ images to MM (with Scan + Publish) but when I jump to page 2 (or any further) of the pagination, I get a 

Error retrieving results: [object Object]

and do not see any images on the following pages.

BTW I very often have issues like that with pagination in PW admin in general, so maybe this is more like a core issue.

(PW 3.0.210)

 

Link to comment
Share on other sites

3 hours ago, fruid said:

I just uploaded 800+ images to MM (with Scan + Publish) but when I jump to page 2 (or any further) of the pagination, I get a 

Error retrieving results: [object Object]

and do not see any images on the following pages.

BTW I very often have issues like that with pagination in PW admin in general, so maybe this is more like a core issue.

(PW 3.0.210)

 

This sort of thing sometimes happen to me when Tracy Debugger is on, and I get an unexpected warning from some random module that messes up any ajax response by errors appended or prepended to it. Maybe you could take a look in the Network tab to see what you got in the pagination response?

  • Like 2
Link to comment
Share on other sites

9 hours ago, fruid said:

I get a 

Error retrieving results: [object Object]

As both you and @elabx have alluded to, it is a tricky one. For MM specifically, since we are using Lister (will change in the next version, most likely, to htmx), it could also point to an error about a particular image on a particular page. The [object Object] is most likely the text of the error that ProcessWire is returning. Like @elabx pointed out, have a look at the Network tab. A 500 error would mean a server error. Some of the possible causes are a very large image that MM did not finish resizing, or there was an error uploading it, hence clogging up stuff. I have received a number of suggestions about handling such stuff, especially from @gebeer.  I'll include this in the next updates. 

Back to your issue, I know 800 images is  lot because it means 800 pages, but if you are able to narrow this down to some possible 'big' images, you can sort out the issue manually by editing the relevant (MM) page. However, this too can make the system hang. So, you might want to resort to the API in that case.

Let me know how it goes

  • Like 1
Link to comment
Share on other sites

On 5/12/2023 at 7:30 PM, kongondo said:

Hi @Boost,

Are you able to install other modules by uploading their zip files? If not, I am thinking is a permissions issue in your system?

I'm able to install any other modules. BTW is this a paid module?

Link to comment
Share on other sites

is this version already available? Or any update for my current version? I'm on version 0.1.2 and was hoping an update would solve some bugs…

One bug I'm having is the pagination (not sure if I mentioned this before). I cannot go to the next pages in the MM pagination. And the little wheel loads forever, see screenshot.

Also, on the bottom you can read

Media Manager (Process) v0.1.2

twice. Seems buggy.

image.png.4c735b1801ccc43d118f83eade440e84.png

Link to comment
Share on other sites

On 4/20/2023 at 5:14 PM, kongondo said:
namespace ProcessWire;

$importedUsualPages = $pages->find("your-selector");

$arrayOfConnections = [
  'my-usual-page' => [
    'id' => 1876,
    'imported_mm_pages_ids' => [2035, 2036, 2038, 2056]
  ]
];

foreach($importedUsualPages as $importedUsualPage){
  $importedUsualPage->of(false);
  $mmField = new WireArray();
  $importedMMPagesIDs = $arrayOfConnections[$importedUsualPage->name];
  foreach($importedMMPagesIDs as $importedMMPageID){
    $mmFieldItem = new WireData();
    $mmFieldItem->id = $importedMMPageID;
    $mmFieldItem->type = 3;// 1-audio; 2-document; 3-image; 4-video
    // add MM item to WireArray
    $mmField->add($mmFieldItem);
  }
  // -----
  // populate mm_field of page
  $importedUsualPage->set('mm_field', $mmField);
  $importedUsualPage->save('mm_field');

I tried this approach but I get

Value set to field 'mema_images' must be a MediaManagerArray

(mema_images being the field of type "MediaManager" on the template for the pages where I want to "add" images or technically speaking refer to the image-pages)

 

  • Like 1
Link to comment
Share on other sites

sorry, me again, I hope you appreciate the feedback.

In an upcoming version, could you add the page-ID of the image when listing (or detail view) of an image in the MM? I can see title, name, dimensions, filesize, tags, … but no ID.

  • Like 1
Link to comment
Share on other sites

how can I retrieve the URL (absolute path) of an image added to a media-manager-image field of a page? Can't find the API.

EDIT:

never mind, I figured it out, need to loop even though it's a single image.

foreach ($page->mmfield as $image) {
	echo $image->media->url;
}

right?

  • Like 1
Link to comment
Share on other sites

On 5/24/2023 at 3:26 PM, fruid said:

I tried this approach but I get

Value set to field 'mema_images' must be a MediaManagerArray

(mema_images being the field of type "MediaManager" on the template for the pages where I want to "add" images or technically speaking refer to the image-pages)

@fruid. Sorry for the delay in getting back to you. Long weekend here. 

Please change the relevant code to:

<?php

namespace ProcessWire;

$importedUsualPages = $pages->find("your-selector");

$arrayOfConnections = [
  'my-usual-page' => [
    'id' => 1876,
    'imported_mm_pages_ids' => [2035, 2036, 2038, 2056]
  ]
];

foreach($importedUsualPages as $importedUsualPage){
  $importedUsualPage->of(false);
  $mmField = new MediaManagerArray();
  $importedMMPagesIDs = $arrayOfConnections[$importedUsualPage->name];
  foreach($importedMMPagesIDs as $importedMMPageID){
    $mmFieldItem = new MediaManager();
    $mmFieldItem->id = $importedMMPageID;
    $mmFieldItem->type = 3;// 1-audio; 2-document; 3-image; 4-video
    // add MM item to MediaManagerArray
    $mmField->add($mmFieldItem);
  }
  // -----
  // populate mm_field of page
  $importedUsualPage->set('mm_field', $mmField);
  $importedUsualPage->save('mm_field');
}

Let me know how it goes.

Link to comment
Share on other sites

On 5/24/2023 at 10:15 PM, nurkka said:

I just watched the video and it looks very good!

Thanks @nurkka

On 5/24/2023 at 10:15 PM, nurkka said:

I assume the PDFs won't have thumbnails in Media Manager

I am working on showing preview thumbnails actually. But I still get your point about long filenames.

On 5/24/2023 at 10:15 PM, nurkka said:

so it would be very good if one could switch the view to a really compact list view, where the filenames would not be cropped.

I agree. There will be a list view. However, I cannot guarantee that the filenames would not be cropped, i.e., we cannot control for how long a filename will be, especially in some non-English languages. However, we'll try and get in as much text as we can.

On 5/24/2023 at 10:15 PM, nurkka said:

Perhaps in this list view also some other meta data could be shown, like filesize etc.

The current plan is to have the meta data in a sidebar to the right (like GDrive).

On 5/24/2023 at 10:15 PM, nurkka said:

So I am wondering if you could consider an option to not crop those titles or filenames at all?

I'll consider this. Maybe make it configurable.

 

On 5/25/2023 at 3:47 PM, fruid said:

EDIT:

never mind, I figured it out, need to loop even though it's a single image.

foreach ($page->mmfield as $image) {
	echo $image->media->url;
}

right?

@fruid, Yes, exactly. Please see the docs:

Accessing Media Manager Objects Properties

Media Manager Objects

Link to comment
Share on other sites

what would be very handy is to see in the media-manager field (on a page) as well as in the media manager itself:

- the ID of the file/image
- the title of the file/image (I can see the name, description, tags but no title)
- not just how often but where on which page(s) it was used! (and maybe an edit-link to those pages??)

Plus when I have an image in front of me, either in the media-manager field on a page or in the media-manager, I cannot edit see the description field. I can click on "Edit" (on the image) which opens a dialogue. There I can edit title, name and the file itself but not the description. I have to click on "Edit" (on the image) again to open another dialogue inside the dialogue to edit the description and tags. This is not a big deal, just wanted to mention that it doesn't say description anywhere around the field so someone might be confused.

Concerning my requirement of searching an image by the page(s) it appears in, I thought of a maybe feasible solution. How about you can search an image by tags and then upon saving a page, add the title of the page as a tag to the image and of course remove the tag when removing the image from a page?

EDIT: OK that last part is maybe too ambitious

Link to comment
Share on other sites

@kongondo I have some images that use a different caption depending on the page they appear on. Can you think of a solution for this?

EDIT:

I was thinking, in order to accomplish this, maybe I can add a text field next to the image that I want to use that, if populated, would override the image caption. But, since I use many images on one page, I would need to have a text field like that on the page template the image appears on (not on the media-manager-image template), and also one for each image to make this work, thus also need multiple media manager image fields on one page. Therefore, here's my other question: 

Would it be possible to use a media manager image field inside a repeater field or repeater matrix field?

  • Like 1
Link to comment
Share on other sites

Hi @fruid,

On 5/30/2023 at 4:29 PM, fruid said:

Plus when I have an image in front of me, either in the media-manager field on a page or in the media-manager, I cannot edit see the description field. I can click on "Edit" (on the image) which opens a dialogue. There I can edit title, name and the file itself but not the description. I have to click on "Edit" (on the image) again to open another dialogue inside the dialogue to edit the description and tags. This is not a big deal, just wanted to mention that it doesn't say description anywhere around the field so someone might be confused.

I am totally confused by this ?. When editing a media item (i.e. inside media manager), you are editing the page where the media item lives. In the case of an image, the image is in a normal ProcessWire image field. So, the description, tags, cropping, etc are all native ProcessWire inputs and functions. 

On 6/1/2023 at 12:16 PM, fruid said:

Would it be possible to use a media manager image field inside a repeater field or repeater matrix field?

Yes it is. 

  • Like 1
Link to comment
Share on other sites

On 6/1/2023 at 12:16 PM, fruid said:

I have some images that use a different caption depending on the page they appear on. Can you think of a solution for this?

I'll see if I can include his in the next version of Media Manager. My current thinking is that I'd add an extra column/subfield to FieldtypeMediaManager. 

  • Like 1
Link to comment
Share on other sites

I know a media_manager_image field is always an array so I need to loop through it.

But can I access a specific image given the key?

I tried:

$image = $page->mmfield[3];
$image = $page->mmfield->get(3);
$image = $page->mmfield->eq(3);

none of those work ;( 

Link to comment
Share on other sites

Hi @fruid

Just to be clear, "media_manager_image" is an internal native ProcessWire field of type FieldtypeImage used by media manager to store media items that are of type image. Its value is a Pageimages object.  Back to your issue, mmfield should be a Media Manager field of type FieldtypeMediaManager. Its value is a MediaManagerArray. A MediaManagerArray contains one or more MediaManager objects. This is analogous to a WireArray can contain several objects of type WireData.

36 minutes ago, fruid said:
$image = $page->mmfield[3];
$image = $page->mmfield->get(3);
$image = $page->mmfield->eq(3);

All these work for me. The value of $image here is a single object of type MediaManager. What do you get when you dump $image using Tracy?

Screenshots

test_1_media_manager is equivalent to your mmfield.

1542528280_2023-06-04130456_mm_single_retrieval.thumb.png.d8a9a24ce312dc51026786da4f2626ba.png

664281828_2023-06-04130456_mm_single_retrieval_dump.thumb.png.0d86ca6f154832068e76d16d8aea74b2.png

1405515960_2023-06-04130456_mm_single_retrieval_dump_single_mediamanagerobject.thumb.png.e807133a781f2da8d066c4d2a2bc5b2b.png

 

Edited by kongondo
added more
  • Like 1
Link to comment
Share on other sites

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