Extension:StripExifGPSData
![]() Release status: stableCategory:Stable extensions |
|
---|---|
Implementation | User interfaceCategory:User interface extensions, SkinCategory:Skin extensions |
Description | A MediaWiki extension that strips out Exif GPS data from images during the upload process. |
Author(s) | Derf Jaggedtalk |
Latest version | 1.11 (2025-07-08) |
MediaWiki | 1.35+Category:Extensions with manual MediaWiki version |
PHP | 5.5+ |
Database changes | No |
License | MIT License |
Download | GitHub: Note: |
StripExifGPSData is a MediaWiki extension that strips out Exif GPS data from images during the upload process. This effectively removes any worry that users are uploading images that might leak their current or home location, as many cellphones or cameras automatically attach GPS coordinates to photos.
Setting $wgShowEXIF = false;
in LocalSettings.php will disable metadata from being displayed in the File: page.
However, the data still exists in the image itself, and that's where this extension comes in.
For reporting an issue or a bug, please open a GitHub issue.
Installation
Requires MediaWiki 1.35 or higher.
- Install the third-party tool exiftool on the OS and ensure "exiftool" is a valid command. This can be installed on a Linux distribution with the command:
apt install libimage-exiftool-perl
- Download and place the file(s) in a directory called
StripExifGPSData
in yourextensions/
folder. - Add the following code at the bottom of your LocalSettings.php file:
wfLoadExtension( 'StripExifGPSData' );
Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
Configuration
You can optionally edit StripExifGPSData.php to change the line containing:
$cmd = "exiftool -overwrite_original -gps:all= " . escapeshellarg( $path );
to strip any desired metadata. For instance, to strip all metadata:
$cmd = "exiftool -overwrite_original -all= " . escapeshellarg( $path );
Documentation can be found on the exiftool website.
Notes
- You are not required to set
$wgShowEXIF = false;
to use this extension, but may be useful for your wiki. - Given that the GPS metadata is stripped after the image is uploaded, you may still see the original metadata-tagged image for some time if you have caching enabled.
- This extension will not remove any metadata from images already on your wiki. To do this, you can use exiftool as described below.
- To remove metadata from a single file:
exiftool -gps:all= -overwrite_original /var/www/YOUR_SITE/wiki/images/a/bc/File_Containing_GPS_Info.jpg
- To remove metadata from all files:
exiftool -csv -filename -gps:GPSLatitude -gps:GPSLongitude /var/www/YOUR_SITE/wiki/images/ -r > ./output.csv
- Open the CSV, sort by GPSLatitude, then copy all filenames with GPS info to a file called input.txt and upload it to the server and run:
tr -d '\r' < input.txt > cleanlist.txt && xargs -a cleanlist.txt exiftool -gps:all= -overwrite_original
- Run
php maintenance/refreshImageMetadata.php
to update the metadata in the backend.
- To remove metadata from a single file: