Show Your Photos in a New Browser Tab

|

The new tab area in your browser can be put to a variety of practical uses: from displaying time zone to taking notes and managing daily tasks. It's also possible to configure the new tab to showcase your photos. To do this, you need three things: 1) a folder with photos on a web server, 2) a simple PHP script, 3) the New Tab Override extension for Firefox or the Change New Tab extension for Chrome and Chromium.

Before you upload the desired photos to a folder on your web server, it's a good idea to resize them to make them load quickly. If you have ImageMagick installed on your system, switch to the local directory containing the photos and run the command below (if needed, adjust the file extension, resize, and quality values):

for file in *.jpg; do mogrify -resize "1200>" -quality 95% $file; done

Keep in mind that this command replaces the original images with the processed ones. If you don't want that, use the following command which saves the resized images with the .JPG file extension:

for file in *.jpg; do convert -resize "1200>" -quality 95% $file "`basename $file .jpg`.JPG"; done

Upload the resized images to a folder on the web server. Fetch then the PHP script using the wget -O newtab.php https://gitlab.com/snippets/1832587/raw command. Open the downloaded netab.php file for editing, and make sure that the value of the $ext variable matches the file extension of the photos. Move the script to the folder on the web server containing the resized photos.

Install the New Tab Override extension, open the extension's preferences page and specify the URL of the PHP script in the corresponding field. If you happen to use Chrome or Chromium, install the Change New Tab extension, and specify the URL when prompted.

When you're done, open a new tab, and you should see a random photo.

This is an excerpt from the Linux Photography book. Get your copy from Google Play Store or Gumroad.