Just Released: 4.3 adds support for replacing existing media files

Just Released: 4.3 adds support for replacing existing media files

By | 2017-02-10T14:31:29+00:00 February 10th, 2017|Announcements|0 Comments

Yesterday we released Gallery Server 4.3. You can now replace the file of an existing media asset without losing any metadata or changing its ID. There is also an improved algorithm for generating resized client-side images. And, as always, there are bug fixes.

How to apply this update

If your existing gallery is 4.X, upgrading is easy — just copy the files from the upgrade package over your existing installation. There are no web.config changes to merge and you don’t have to worry about the version_key.txt file or your license information. Get the upgrade package from your downloads page. If you are upgrading from an earlier version, follow the instructions in the Admin Guide.

Replace existing media asset

This has been a top feature request and we are glad to finally implement it. It is available in all editions, including Gallery Server Free. Beginning with 4.3.0, a new replace button appears in the ribbon toolbar:


Clicking the button brings up a small window where you can select a replacement file:


After you select a replacement file, click the Upload & Replace button to send it to the server, where it will replace your original media asset file.

This is great for those situations where you need to update the file associated with a media asset. For example, you may be editing an image in Photoshop, updating a document, or trimming a video. In each of these cases, you can download the file, make your change, and then use the replace function to push it back to the server. The ID remains the same, and most of the asset’s properties are unchanged.

Which properties change? Well, they’re the ones you would expect, as they are properties of the file and it makes sense to refresh them. They are width, height, dimensions, orientation, file name, file size, audio format, video format, bitrate, and duration. That is, Gallery Server recalculates these metadata from the uploaded file and updates the corresponding properties of the asset in your gallery.

What about other properties, especially those that tend to be embedded in images such as date picture taken, shutter speed, and camera model? It was a challenge for us to figure out the best approach here, because we can think of pros and cons to the different options. If Gallery Server re-extracts all metadata from an image when it is replaced, you may lose valuable data in those cases where your image editor stripped out meta properties when you saved it. If it doesn’t re-extract, you won’t get meta updates you’ve made with an external tagging or metadata writing program. There wasn’t a single approach guaranteed to be what you want in all cases. In the end, Gallery Server recalculates the file-based meta properties and leaves the rest alone. We think this is the right balance that will work for most users.

If you want Gallery Server to re-extract all the meta properties, delete the original media asset and then upload the replacement file. Gallery Server treats this as a new media asset, so it will have a new ID. Any external links that pointed to your old media asset will not automatically link to the new asset, so keep that in mind.

Which properties get pushed into the replacement file?

We talked about how Gallery Server updates the properties of the media asset. But it can also write properties to the original JPG image file. During file replacement, does Gallery Server push the current properties of the media asset to the internal metadata of the replacement file? It depends on whether you’ve enabled metadata writing on the Metadata page in the site admin area.

In the above screenshot, the tags property is writable and the title and caption properties are not. Let’s say you have an image media asset and you’ve entered values for all three of these properties. Then you use the new replace function to swap the file with another image. Gallery Server will push the tags into the replacement file but not the title or caption. All three properties continue to appear in the gallery just as before.

Higher quality client-side image resizing

We kind of cheated with this one, since we didn’t write it. It’s a new feature of the upload widget plUpload. It uses an improved algorithm to generate resized client-side images. This comes into play when you upload images on the Add media page:

When you select the option to discard the original file, Gallery Server, through the upload widget, generates a web-optimized image on the client and uploads that to the server. The biggest benefit to this is faster uploading, since the resized images are often dramatically smaller than the original. The new algorithm uses bilinear resampling to create a high quality image. Nice!

Bug fixes

Gallery Server has become very stable in the last few releases, and there just aren’t many bugs to fix. This release has just two. Read more about them here.

  • User with EditMediaObject permission may get permission error when using the image editor
  • Thumbnail image may have incorrect width and height after rotation

About the Author:

Founder and Lead Developer of Gallery Server

Leave A Comment