Media Sync

설명

You can scan all files that are in “uploads” directory and see which ones are actually in Media Library and which ones are just sitting there. Then you can select those that you want to import to database and therefore make them available in Media Library.

You can also use FTP to upload your files to “uploads” directory and use this plugin to bring those files into Media Library. There are other plugins that can be used for that, but with this one you can easily select all and import all at once.

Why I created this plugin

I once copied WordPress site to a different server and Media Library ended up being empty, even tho all files were in “uploads” directory and database was copied. So I had to use some other plugin which required me to manually enter each directory and import files in batches per each directory. But I needed something to just import everything at once, so I created this plugin.

Ignored files

  • index.php,
  • various hidden files (.DS_Store, .htaccess),
  • WP generated thumbnails (files ending with for example -100×100.jpg),
  • WP generated scaled images (files ending with -scaled).

This is now configurable with a custom hook function and it can totally overwrite these rules or add additional ones.

스크린샷

  • Initial Page
  • Example of selecting files for import
  • Import to Media Library in progress
  • Import completed

설치

  1. Upload media-sync directory to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress

FAQ

Q: Stuck at importing / spins endlessly
A: Please try to increase max_execution_time in php.ini on server (as described here). Or if you have too many files, try going to Settings -> Media Sync and change “Scan directory” to some inner folder.

Q: Files not showing up in Media Library
A: Please make sure “Dry Run” option is NOT checked. This is a safety mechanism to make sure you know what you’re doing, so be careful, try it first with just one file.

Q: Doesn’t work
A: Please first try to turn on debugging by adding this: define('WP_DEBUG', true); to your wp-config.php and check Network tab in Chrome DevTools to see what is going on in the background. Then report actual errors since it’s hard to help without knowing the error which is causing the problem.

후기

2020년 July 29일
I tried every possible option. It does see the media uploads after scanning, but when you hit import, and it "finishes", no media is on the media library and it just ask to re-scan again.
2020년 July 16일
I had to insist a few times, there is some resistance to import. But, I managed to make all my images. Thank you very much and congratulations
2020년 July 6일
I recently updated the theme and backend of a site with a large number of images. It would have been a waste of time to manually add all images in the new theme. So, natually, I uploaded all images via SFTP. Problem? None of the images were added to the WordPress database. Yikes 🙁 After paniking for a few minutes, quick researched turned up Media Sync! Media Sync imported all images in to the new database and I was up and running. Thank you, Media Sync! Bryan
2020년 July 1일
This is a big time-saver. The plugin works well for me and lets me add media-files in bulk from the server (uploaded through FTP) with only a few clicks. A BIG thank you!
모든 29 평가 읽기

기여자 & 개발자

“Media Sync”(은)는 오픈 소스 소프트웨어입니다. 다음의 사람들이 이 플러그인에 기여하였습니다.

기여자

“Media Sync”(이)가 1(으)로 번역되었습니다. 기여해 주셔서 번역자님께 감사드립니다.

자국어로 “Media Sync”(을)를 번역하십시오.

개발에 관심이 있으십니까?

코드 탐색하기는, SVN 저장소를 확인하시거나, 개발 기록RSS로 구독하십시오.

변경이력

1.1.8

  • Fix handling big (“-scaled.jpg”) images introduced in WordPress 5.3. These files will now be skipped and won’t be imported multiple times.
  • Add handy “Re-scan” button.

1.1.7

  • Fix issues when importing files containing special characters

1.1.6

  • Slight improvements with error handling in JavaScript

1.1.5

  • Always convert backslashes (“\”) to forward slashes (“/”) to fix various issues when using Windows Server.

1.1.4

  • Important backslash (“\”) vs forward slash (“/”) fix for use on Windows Server.

1.1.3

  • New option to set “Scan directory” in settings which will allow checking only certain sub directory.
  • New hook function media_sync_filter_is_scan_object_ignored which can be used to overwrite which files are ignored by default or to just skip additional files.

1.1.2

  • Fix Smart File Time on Windows server

1.1.1

  • Reduce the maximum number of items to import per batch from 20 to 10.
    So batch sizes are now: 1 (importing 1 to 10 items); 5 (importing 11 to 100 items) or 10 (importing more than 100 items)

1.1.0

  • [IMPORTANT] Date of imported Media Library items now defaults to the current date.
    But there are options to choose before importing and also a possibility to overwrite that using the custom hook.
  • New options page with the option to disable and hide “Dry Run”.
  • Fix Media Library filter that was showing all items when the filter didn’t find any result.

1.0.4

  • Reduce the number of items to import per batch

1.0.3

  • Support multisite network by changing required access capability from update_plugins to import

1.0.2

  • Another fix for get_current_screen error

1.0.1

  • Fix get_current_screen error

1.0.0

  • New option to clean up Media Library from items that are missing actual files (using custom Media Library filter)
  • New filter when scanning uploads directory which can help to show only files missing from Media Library

0.1.6

  • Fix PHP short array syntax
  • Update required PHP version to 5.4

0.1.5

  • Date of imported Media Library item is now set based on file modification timestamp

0.1.4

  • Add plugin localization
  • Add Serbian translation

0.1.3

  • Various improvements and fixes

0.1.2

  • Fix sorting of directories and files
  • Minor wording changes and code cleanup

0.1.1

  • Fix error on activation

0.1.0

  • Initial plugin features