0

Remove Part of File Names using PHP

Since David’s Batch Processor was pre-installed in GIMP on Ubuntu Studio, I used it extensively in the ICAF Gallery project today. My goal for these images is to resize their thumbnail version to 10KB or smaller and retain the original size for the enlarged version. Because most of these images are in different resolution, I randomly selected the scale value in the Batch Processor to resize the images. Then I had to manually view the file size of each image to see whether or not an image has to be resized again. After the differentiation, I moved the images that need to be resized once more to a new sub-directory and started the above process one more time. I would repeat these steps again and again until all the thumbnail version of the images are under 10KB.

During the early use of the Batch Processor, I missed a very important feature that is to save the newly processed images to a different folders. This resulted my decision to write this Batch File Name Remover script. The source code for this script is very easy to understand. It’s just some PHP functions plus two Linux commands: ls and mv. I always place a postfix after the file name of processed thumbnails: “-thumb”. Because of that, I need to remove this postfix whenever I repeated the above resize steps. The ls command is used to list the file name that contains the specified characters into an array. The mv command is used to remove the specified characters from the file name using PHP explode function. I used PHP instead of native Linux Bash script because PHP is easier than Bash for me :) . The source code for this script is available here.

Below is the Batch File Name Remover in action:

0

Transitioning to Ubuntu Studio

Ubuntu Studio LogoYesterday I switched to Ubuntu Studio 10.04 mainly because I love the audio production tools available in the distro. The first time I tried to install Ubuntu Studio from the original DVD was a failure. That’s probably because this distro is usually for multimedia workstation, therefore it doesn’t install NetworkManager by default. As the result, I didn’t get very far with this original distribution because of the wifi struggle.

Instead, I reinstalled Ubuntu 10.04 and upgraded to Ubuntu Studio by following this Ubuntu Documentation article. Here is the video preview of the Application menu in the Original Ubuntu Studio:

Note that I installed the distro inside VirtualBox using original DVD ISO image in the above video to show the different default interface between Ubuntu and Ubuntu Studio. The version of Ubuntu Studio upgraded from the original Ubuntu installation is very different, notably the NetworkManager.

I’m currently in the process of transitioning to this new Ubuntu environment. I have many tasks to complete like deciding which applications to reinstall and restore their configurations from my backed up home directory, etc. Once I finished all these tasks (probably today), I will start to learn about the tools available in Ubuntu Studio like LMMS and StopMotion. Look forward to the upcoming posts about these tools.