Bulk converting large PS4 screenshot png images into 1080p jpg’s

A niche example of how I bulk convert my screenshots to make them more website-friendly.

I tend to have my screenshots set to the highest resolution when saving on my PlayStation 4.

However, when I upload to the screenshots area of this website, I don’t want the images to be that big — either in dimensions or file size.

This snippet is how I bulk convert those images ready for uploading. I use an Ubuntu 20.04 operating system when running this.

# Make sure ImageMagick is installed
sudo apt install imagemagick

# Run the command
mogrify -resize 1920x1080 -format jpg folder/*.png

You can change the widthxheight dimensions after the -resize flag for your own required size. As well as changing the required image format after the -format flag.

Updating PHP versions in Ubuntu 20.04

Installing an older PHP version and switching to it in Ubuntu.

For an older PHP project, I needed to install an older version of PHP. This is what I did to set that up.

Installing a different PHP version

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php7.1

Rebinding php to required version

Some of these binds are probably not need. I think the main ones, at least for my use case, were php and phar.

sudo update-alternatives --set php /usr/bin/php7.1
sudo update-alternatives --set phar /usr/bin/phar7.1
sudo update-alternatives --set phar.phar /usr/bin/phar.phar7.1
sudo update-alternatives --set phpize /usr/bin/phpize7.1
sudo update-alternatives --set php-config /usr/bin/php-config7.1

For some reason the --set flag stopped working, so I had to use:

sudo update-alternatives --config php
sudo update-alternatives --config phar

etc. And update each one with the terminal prompt options for each.

p.s. If using PHP-FPM, you could also set up different server conf files and point the FPM path to the version you need. My need was just because I was using the command line in the older project.

100 Days : Day Seven (94)

Decided to Install Windows 7 back on to my P.C. as the primary operating system, then run GNU/Linux within virtualbox. Thought I’d give steam games on windows another go as I’ve got 8gb of ram sat there not really doing much. This way all my development stuff can be encapsulated within the virtual machine.

Also looks like I could be going to see Chas & Dave in a couple of months. I’d never heard much of their music until I started working at PM Connect. I gotta say they are growing on me.

There is always a logical answer

I installed Ubuntu server on my spare computer the other day and all was fine.

I then moved the Apache document root to a directory in my home folder — a common thing done by people, I hear.

I have done this many times before and always worked fine — as did this for a time.

I had done this via ssh as is common with a server OS. Only thing was, was once I exited the ssh, Apache seemed to stop working.

I spent about an hour then, at around midnight, trying to figure out what had gone wrong. What had I done differently? The answer was simple: nothing…… or so I thought.

Turns out I had encrypted my home directory on installation of the OS. Probably a good thing to do, except that of course when trying to view the Apache server page in a browser it would error — due to my having moved it’s root from its default into my home folder.

As soon as I logged in via ssh to the server, it would work again. But when exiting it would stop.

This was simply down to the fact that my logging into the home directory via ssh would cause it to decrypt itself — making the apache page viewable. And then when I exited the ssh, it would re-encypt, thus breaking it.

Fu fu fu.

Off to see Mission Impossible: Rogue Nation tonight. Really looking forward to it.

I just hope there are no annoying people about. i.e. screaming kids, idiots on phones, people saying things like “Oh he was in thingymajig” or “This bit is sick”.

I must be getting old.