Linux 软件免费装
Banner图

One Folder Gallery for OneDrive

开发者 robindecroock
更新时间 2026年9月21日 06:19
捐献地址: 去捐款
PHP版本: 8.1 及以上
WordPress版本: 7.1
版权: GPLv2 or later
版权网址: 版权信息

标签

photos gallery lightbox microsoft onedrive

下载

0.1.1 0.1.2

详情介绍:

One Folder Gallery for OneDrive shows the photos from a single, isolated folder in your Microsoft OneDrive on your WordPress site. What matters here is what the plugin cannot do. Microsoft gives it a key to one folder, the one it makes for this plugin, and to nothing else. Your documents and your other photos stay out of reach, and a mistake in my code cannot widen that. You do not have to take my word for it either: Microsoft lists on the sign-in screen exactly what it is handing over, before you agree to anything. How it works Your photos stay in your own OneDrive, in one folder Microsoft makes for this plugin and keeps apart from everything else. Every subfolder in it is an album. The subfolder's name is the title your visitors see: Apps/One Folder Gallery/ Trip to Lisbon/ <- an album DSC_0001.jpg DSC_0002.jpg The garden in June/ <- another album rose.jpg loose-photo.jpg <- not shown, it is not in an album So you run your galleries from OneDrive. New subfolder, new album. Rename it and the title follows. New photos show up within a few minutes, or at once if you press Refresh now. In WordPress there are two moments. Once, you connect your account by typing a short code on Microsoft's sign-in page. After that you drop the gallery block on a page and pick an album. No app registration, no client secret. Step by step: see Installation below. Order Numbers count as numbers, so photo 2 comes before photo 10. No need to pad names with zeroes. Block editor Add the One Folder Gallery block (under Media, or search for "onedrive"). Its sidebar lists the albums in your OneDrive folder, so you can pick one without copying an id from anywhere, and set the layout and the number of columns. Choose All albums to let visitors pick an album themselves. The block previews the real gallery while you edit, and the editor's own Advanced panel, alignment and spacing controls apply to it like to any other block. An existing [one_folder_gallery] shortcode can be converted into the block. Shortcodes The shortcode stays available for the classic editor, widgets and page builders. The classic editor has a Choose OneDrive folder button that browses your albums and inserts the shortcode for you. Layouts Three layouts ship with the plugin. Pick one in the block sidebar, or with the layout attribute on the shortcode. None of them uses JavaScript to position anything, so the gallery does not shift around while the photos load. Justified rows and masonry only come into their own when your photos have different shapes. If everything in the album is the same size, all three layouts look much the same. The height of a justified row is 220 pixels by default, and 150 on a phone. You can change that with --onefg-row-height; see Matching your theme below. Matching your theme This part is for whoever writes the CSS on your site; hand it to them if that is not you. The gallery ships deliberately plain and takes its colours, fonts, shapes and spacing from CSS custom properties, so it can be made to match your site without fighting the plugin's own styling. Set the properties you want in your theme's custom CSS, on :root for every gallery on the site, or on a class you gave one gallery: :root { --onefg-album-min: 240px; --onefg-album-gap: 24px; --onefg-album-radius: 20px; --onefg-album-ratio: 4 / 3; --onefg-album-card-bg: #fff; --onefg-album-card-padding: 12px; --onefg-album-card-radius: 20px; --onefg-album-card-shadow: 0 2px 12px rgba(0, 0, 0, .08); --onefg-album-name-family: "Anton", sans-serif; --onefg-photo-radius: 12px; --onefg-gap: 16px; --onefg-row-height: 260px; --onefg-spinner-color: #c1614a; } There are around fifty of these, covering the album tiles, the photo grid, the loading spinner, the messages and the lightbox. I wrote the full list with every default into the comment at the top of assets/style.css, so it cannot drift from the code. Two are worth knowing about up front: --onefg-photo-ratio and --onefg-album-ratio take any shape, so your photos do not have to be square, and --onefg-photo-fit: contain shows whole photos instead of cropping them to fill the tile. One exception. I build the lightbox once and hang it at the end of the page, never inside the photo grid, so that reloading the grid cannot break it. The cost is that its properties, such as --onefg-lightbox-bg, only work site-wide and not on one gallery's class. The gallery also respects the visitor's reduce motion setting: the hover zoom and the loading shimmer stop, and the spinner slows down. Developers who want to add a layout of their own to the block's Layout dropdown will find the one filter the plugin offers documented in the source repository. Important: everything in the app folder can become public [one_folder_gallery] without a folder lists every album in the app folder, and anyone visiting that page can open them. Only put photos in the app folder that you are comfortable showing publicly. The plugin does not add password protection or per-album access control. Photos stay in OneDrive Nothing is copied to your web server. Visitors' browsers load the images directly from Microsoft's servers, which is also why Microsoft sees your visitors' IP addresses. See the Privacy section below. Work and school accounts Personal Microsoft accounts work out of the box. For a Microsoft 365 work or school account it depends on how your organisation is configured. Three things can get in the way: Two ways out, whichever it is. Ask your administrator to approve the application. Or make your own app in Microsoft Entra with public client flows enabled, and paste its Application (client) ID under Advanced in the settings. Neither needs a client secret. How this plugin was made This plugin and this readme were made with AI help. I read it all, tested it, and decided what shipped, so the mistakes are mine. Tell me about them on the support forum.

安装:

  1. Install and activate the plugin.
  2. Go to Settings → One Folder Gallery for OneDrive.
  3. Click Connect to OneDrive and follow the code shown on screen.
  4. Click Check / create app folder. Microsoft creates Apps/One Folder Gallery in your OneDrive.
  5. Add a subfolder per album in OneDrive and upload your photos. The subfolder's name is the album title on your site.
  6. Add the One Folder Gallery block to a page and pick your album in its sidebar. In the classic editor, use the Choose OneDrive folder button instead.
Your web host needs PHP's sodium extension, which has been standard since PHP 8.0, so almost every host has it. Without it I let the plugin refuse the connection outright, rather than leave your sign-in lying around unprotected.

屏幕截图:

  • The same album in all three layouts: grid crops every photo to one shape, justified rows keep each photo's proportions at an equal row height, and masonry crops nothing at all.
  • Clicking a photo opens it in a lightbox, with its name and position in the album.
  • The block in the editor. Its sidebar lists the albums in your OneDrive folder, so there is no folder id to copy anywhere.
  • Connecting an account: type the code on Microsoft's own sign-in page. No app registration, no client secret.
  • The settings screen, with the shortcodes listed for use outside the block editor.

常见问题:

Can the plugin see the rest of my OneDrive?

No. It asks for Files.ReadWrite.AppFolder, which Microsoft limits to the one folder it makes for this plugin. Watch for Files.Read.All or Files.ReadWrite.All on that sign-in screen, for any plugin: those mean your whole drive.

Do I need to create an app registration in Azure?

No. You sign in with a code, the way you would on a smart TV.

My photos do not appear after uploading them

Listings are cached for a few minutes, so your site stays fast and Microsoft does not throttle it. Refresh now on the settings page clears that at once.

Microsoft says the publisher is unverified. Is that a problem?

It means Microsoft has not confirmed who is behind the application. It changes nothing about what the plugin can reach. If your organisation only accepts verified publishers, an administrator has to approve it, or you use your own application under Advanced in the settings.

Are the albums password protected?

No. Whoever can open the page can see the photos. Use WordPress' own page visibility for that, and keep private photos out of the folder.

How many photos can one album hold?

Up to 4000. I stop there.

更新日志:

0.1.2 The readme only. Plain language, shorter answers, and a folder tree instead of four steps. The plugin itself is unchanged. 0.1.1 First release in the plugin directory.