• Resolved wpdevtech

    (@wpdevtech)


    Hello David,

    Thanks for this great plugin. There is an issue after updating the media date “Uploaded on”. The Media library grid view is not loading all images (it loads about 100 images and then stops). I found that grid view only works if the plugin is active and “Enable Media Grid Enhancements” is checked.

    Is it possible to make grid view work even if the plugin is not active?
    Also, is it possible to make media upload on selected date folders?

    Thank you

    • This topic was modified 3 years, 9 months ago by wpdevtech.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author David Lingren

    (@dglingren)

    Thanks for the positive feedback on the plugin and for your report. I have done some quick testing and I cannot reproduce the problem you described.

    You wrote “There is an issue after updating the media date “Uploaded on”. ” Does that mean the problem did not occur before the updates? Can you tell me more details about the update you made and how you made them? I can try to make similar changes on my system to more closely reproduce your results.

    You wrote “The Media library grid view is not loading all images (it loads about 100 images and then stops).” On my system the Media/Library grid view is able to load 482 items, including PDF documents and other non-image items. Do you have any problems in List mode; I get identical results in Grid and List modes.

    You wrote “I found that grid view only works if the plugin is active and “Enable Media Grid Enhancements” is checked.” On my system I get identical results with MLA enabled and with MLA completely disabled. I also get identical results with MLA enabled and the “Enable Media Grid Enhancements” option unchecked.

    You asked “Also, is it possible to make media upload on selected date folders?” I am not sure what you mean. Do you want to change the file system directory the media are stored in when they are uploaded? If so, this is set by WordPress and MLA is not involved. If you mean something else, any additional details you can provide will be helpful.

    Thread Starter wpdevtech

    (@wpdevtech)

    Thank you very much for the quick response. I am working on re-design the site with a new Divi theme. The old theme had issues with the media library. Many thumbnails became the main image and showing up in the media library.
    Please check the screenshot image link here – https://we.tl/t-W9ThMdPhWh

    To fix this issue, I have permanently deleted all images from the media library. Also, some images from the upload folder were not showing up in the media library. So I also deleted images from the upload folder manually.

    Now, I have to upload images again but I have to upload images to the same date/folder as they were. So it can not break image links on the site. So, I found a solution for this from this article.
    https://ingram-braun.net/erga/2020/04/how-to-date-back-media-uploads-in-wordpress/

    Step -1
    This way, I created a draft post with an old date like 2013/02/15. Then I uploaded the image through this post and the image was uploaded to the old date folder same as 2013/02. But this way media library doesn’t show the image uploaded on 2013/02/15 but it shows the current date.

    Step -2
    Now, to fix this final issue. I changed the uploaded dates using the MLA plugin.

    I have repeated steps 1 and 2 for all the folder year/months dates from 2013-2021. and I uploaded about 800 images. Everything worked fine. But I noticed that the media grid is not loading all 800 images but it stops at about 98 images.

    Thank you

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update with the additional information. I found the “How to date back media uploads in WordPress” hack fascinating.

    I followed the steps you outlined as I understand them:

    1. Create a draft post using the Classic Editor plugin.
    2. Change the “Publish on” date to, for example, 2/10/2029.
    3. Save the Draft post.
    4. Click the “Add Media” button.
    5. In the Add Media popup window, click the “Upload files” tab.
    6. Drag 88 files into the “Drop files to upload” area.
    7. Wait for the uploads to complete.
    8. Close the Add Media popup window.
    9. Open the Media/Assistant admin page.
    10. Click the “(Parent: xxx)” entry in the Parent/ID column to select all items attached to the draft post.
    11. Select all of the items attached to the draft post by checking the box at the left of the thumbnail.
    12. Pull down the Bulk Actions dropdown, select “Edit” and click “Apply”.
    13. Enter the desired date in the “Uploaded on” text box in the right-hand column, e.g., “2018-02-10 05:04:30”.
    14. Click “Update” to apply the changes.

    Once that was done I was able to select the items using the “All dates” dropdown control above the Media/Assistant submenu table. I was able to do the same in the Media/Library screen without any problems in List mode. All 247 items in the Media Library were displayed.

    In Grid mode I got inconsistent results that were along the lines you reported. Only 210 of the 247 items were displayed. I analyzed the network traffic and observed a loop where the browser was repeatedly requesting the sixth “page” of items over and over, without displaying them.

    I realized that the date setting process described above assigns identical date/time values to all of the items. The grid mode code requests items sorted by date in descending order. If many items have identical date/time values this process seems to be unreliable.

    I went back and manually changed all of the date/time values so they were unique (yes, that was tedious). After I finished that process the grid mode display worked perfectly. It looks like the WordPress grid mode code does not handle the case where two or more Media Library items have identical date/time values. I suspect this problem explains the results you are reporting.

    You do not say in your step two exactly how you changed the uploaded dates. Did your process assign the same value to two or more items?

    I realize it may not be practical to manually adjust all of your uploaded date/time values. If you can verify that this might be the cause of your problems I can investigate a more automated solution.

    Thanks for any additional information you can provide.

    Thread Starter wpdevtech

    (@wpdevtech)

    Thank you so much. I really appreciate your help and glad that you found what is actually causing grid items to stop loading.

    You do not say in your step two exactly how you changed the uploaded dates. Did your process assign the same value to two or more items?
    ==> After uploading images to draft post with an old date, I did bulk edit using MLA plugin and set Uploaded on to “2013/02/1”. I did not include time. So by default, it should be like “2013-02-1 00:00:00” and there are lots of images like this same date. As you mentioned this is the reason that stops grid gallery loading new items.

    I think it may be possible to add an extra feature that will generate day and time randomly unique. For example, we set the date for “Uploaded on” to “2018-02” (yyyy-mm) only. Then MLA plugin can generate random unique days and times and complete the date like – 2018-02-10 05:04:30 and other unique dates with different days and times.

    Plugin Author David Lingren

    (@dglingren)

    Thanks for the positive feedback and for your suggestion.

    I think it would be straightforward to add a feature to the Bulk Edit processing to generate unique values. The simple thing is to take whatever is entered in the text box as a start date/time and just add one second to the time for each additional item.

    If that’s acceptable I will investigate further and post an update here when I have progress to report.

    Plugin Author David Lingren

    (@dglingren)

    I woke up this morning with a flash of insight (so rare).

    You can use a content template to modify the “Date uploaded” value in the Bulk Edit area. During the original process, i.e., before the date was changed you could have applied this template:

    template:2013-02-01 [+post_date,date('H:i:s')+]
    

    The above would set the date portion of the value and preserve the existing time value. After the dates were changed you can repair the damage with this template:

    template:[+post_date,date('Y-m-d')+] [+post_modified,date('H:i:s')+]
    

    The revised template preserves the modified date values and adds in the time value from post_modified, which was not altered by the original date change process.

    This worked great on my system. Let me know if you find it helpful.

    Thread Starter wpdevtech

    (@wpdevtech)

    Amazing, that template works great. I really appreciate your help and time to work on this. Thank you very much, David.

    Plugin Author David Lingren

    (@dglingren)

    Thanks for confirming that the suggested template worked for you as well.

    I am marking this topic resolved, but please update it if you have any additional problems or further questions regarding changes to the “Uploaded on” date in the bulk edit area. Thanks again for an interesting question.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Media grid doesn’t load all images after date change.’ is closed to new replies.