Category Archives: Technology

Technology and the things I do with it.

Debian EXIF PHP Picture data for WordPress and nextGEN

How to add or enable exif functions in php and Debian Linux.

I use WordPress and the excellent nextGEN gallery software to manage my site and my photography. I like nextGEN gallery as it seems to do a good job managing pictures and presenting them. It also has the ability to display your exif data if you have the right php modules installed and enabled.

I did not and my exif data and was not showing as enabled (or an option) in my nextGEN. I honestly expected this to be more complicated, but it was simple once I dug a little further. Thank you Debian and your wonderful default configurations. (compiling in this option into Debian’s build but not enabling it by default)

In Debian I did the regular aptitude search | grep exif and did not find anything particular to php and exif that was missing and should be installed. I figured I would look into the php config for my apache2 install.

vi /etc/php5/apache2/php.ini

I did find a section that had exif statements as you can see below. You will want to search for exif or go down until you find this section (Read about exif and php)

[exif]
; Exif UNICODE user comments are handled as UCS-2BE/UCS-2LE and JIS as JIS.
; With mbstring support this will automatically be converted into the encoding
; given by corresponding encode setting. When empty mbstring.internal_encoding
; is used. For the decode settings you can distinguish between motorola and
; intel byte order. A decode setting cannot be empty.
;exif.encode_unicode = ISO-8859-15
;exif.decode_unicode_motorola = UCS-2BE
;exif.decode_unicode_intel    = UCS-2LE
;exif.encode_jis =
;exif.decode_jis_motorola = JIS
;exif.decode_jis_intel    = JIS

Uncomment the “exif.encode_unicode = ISO-8859-15” line so the new segment looks like below

[exif]
; Exif UNICODE user comments are handled as UCS-2BE/UCS-2LE and JIS as JIS.
; With mbstring support this will automatically be converted into the encoding
; given by corresponding encode setting. When empty mbstring.internal_encoding
; is used. For the decode settings you can distinguish between motorola and
; intel byte order. A decode setting cannot be empty.
exif.encode_unicode = ISO-8859-15
;exif.decode_unicode_motorola = UCS-2BE
;exif.decode_unicode_intel    = UCS-2LE
;exif.encode_jis =
;exif.decode_jis_motorola = JIS
;exif.decode_jis_intel    = JIS

Save your changes and then restart apache
/etc/init.d/apache2 restart


Your php5 will be able to read in exif photo data contained in your pictures and nextGEN gallery will be able to display this data. Assuming you have not re sized them in nextGEN gallery (as doing so will remove the exif data) and that the exif data is actually in the pictures to begin with.

You should see PHP Exif support : Yes ( Vx.x ) in the nextGEN gallery main config page.

Colo backup, rsync, ssh, mysql and you… well me.

I have a server located with server pronto in Florida. It’s one of the low end servers and for the most part it works great. Some times they have network problems and once a drive that was failing, they replaced it after a few support tickets. All in all I think it’s a great deal for lower end hosting. This is not my hardware but some white box clone running Debian that is more like a desktop than a “server”. The best thing is that I have root and I’m in control of the server, the hosting company never get’s in my way and they don’t know root or have an account. Its really a colo for computer people as they are very hands off in my experience. Not good for the average beginner user that may break there box or need help form time to time. Still I’ll give them a 5 star for value a 4 start for network and a 3 star for support.

Anyway. There are about 5 domains running on my server (the largest being my wife’s www.klosterisland.com)  and it holds up well enough. As I’m an IT manager at Insight Communications I have Up Time, Backups and Recover-ability on the brain. As this is a low end server, it’s all “single point of failures” all over the place.

With this server being 900 miles away, low end hardware, strangers have physical access and I don’t know the people, backups are very, very important to me.  I use mysqldump scripts, rsync, ssh keys, screen and gzip to get backups to my NAS at home.

Using a directory called /backup I dump mysql DB’s and gzip them there. Then using rsync I sync the colo server data to a server located at home every day at 3:00 AM. On the home server, using a script I gzip the data to a mon/tue/wed/thur/fri/sat/sun directory structure then gzip the data into a single file. I have 7 days of backup on my NAS and can recover the websites with out much stress.

Adding in regular export list of installed packages and exporting the logs off the server, migrating to a new colo or moving to a replacement server is just now time consuming and not a bad experience full of sadness and data loss.

Below us the rsync command I use. your mileage may vary.

rsync –exclude /tmp/ –exclude /proc/ –exclude /dev/ –exclude /sys/ –exclude=”*.MYD” –exclude=”*.MYI” –bwlimit=100 -avz -e ssh /* xxx@xxxx.xxxx.xxx:/opt/storage/colo/current

“reading this” I’m excluding /tmp /proc /dev /sys and mysql DB files and limiting the bandwith to 100Kb and using ssh (with ssh keys) as the backhawl. Before cron runs the rsync I’m mysqldump’ing the DB’s and gzip’ing them to my /opt/backup directory on the colo server. The rsync process comes and sends them to the server at home, updates the target directory called “current”. I then gzip the contents of the “current” directory and place that .gz file into a mon,tue,wed… directory, just to overwritten next week.

I know there are other backup applications out there for linux that are good and free, however this process is SO SIMPLE.

I could add in email notification on failed rsync and perform independat file counts on source and target, build in process lockign etcera. I did not as this seems to work 360 days of the year and for my little colo server. thats well…. good enough.

Server Pronto – www.serverpronto.com

ServerPronto is a company that specializes in dedicated hosting. They have been hosting a server for the past 2 1/2 years and have been a great value for me. I have the starter package and it seems to fit for me! This allows me to continue my education, keep up with my hobby and is a help for my profession during network debug or “second view” testing etc.

The network and power has been pretty good, some times the network has issues but noting that is abnormal. I get around 10Mb – 20Mb transfer rates from my server at ServerPronto. Power and Heat have been managed well over the years as well. Below are some graphs over the last month. (This from a program called munin)

Temp

Power

For my account the support is email ticket only as its the least expensive package. I have had a hard disk failure in the past and they were able to replace the disk and place my data on the new disk. When the server are turned over to me I was able to run right away. This was VERY nice. A server colo is not for everyone. It is much more complicated and requires a lot of experience to maintain a server. If you are looking for website hosting there are easier ways than a colo’ed server.

I like to manage the server and have the flexability to do anyting I see fit and www.serverpronto.com has been a great fot for me. If you are able to manage your one machine remotely and without local access serverpronto is a great deal.

Video Brick

Years ago I was introduced to a fellow tech that was trying to send “live” video over the cellular and wireless network. He had some ideas however the process he developed was basic. He was looking for an investor and was talking to a CV group I know. He had a laptop with a Cellular network card in it and a USB video camera. He used windows media to build a video “stream” from the laptop to a receiving computer. This was clunky and all software based encoding and compression.

After talking to them I suggested using hardware based compression and mini-itx (this was new at the time and hard to get a hold of) hardware. I built a prototype unit and it was encased in a 8″x8″x4″ plastic box. This box had one button, a few lights a fan and a few external IO ports for audio and video. This was a single purpose box running Linux and a few open source packages. I linked a few of them together with some of my own code. Compresses the video and audio using hardware and software, connect to a 4 node Wireless WAN (built for this demo)

It was not possible to have a live broadcast from a place called “4th street Live” here in Louisville KY. It is basically in the heart of down town and getting a “standard” video delivery processes like a remote truck. The remote trucks are very expensive.  This marked the first time any LIVE news cast was produced from this location.

I created the Sending Device and the Receiving that was used at the TV station. The live stream delay was .5MS Below you will see some pictures of the “brick”, wireless radio and a Video Camera. The brick is on a short street lamp. It’s a Grey box 8″x8″x4″ between the parabolic antenna and the camera.

Below you can see the actual live news cast that was performed using the “brick” I developed as a prototype for a local company. They have since made great steps further reducing the footprint and it’s ease of use. I continue to help develop DDNS, management and monitoring as time allows.

[flashvideo filename="video/brick2.flv" /][flashvideo filename="video/brick1.flv" /]

Well, I have managed to not take pictures of this project and all I have is the end result.