Center Align Featured Images in Genesis

One of the things that bugs me about the featured image setting in the Genesis framework is that you can only choose left or right align… you can’t center align!

Center Align Featured Images in Genesis

Of course, if I always used images that were all exactly the right size and aspect ratio on my Genesis based sites (all the newer ones), then it wouldn’t be an issue…

But that’s not always practical, and if the featured image is a little smaller than expected, then left align can leave you with text floating off the right hand side of the image like so…

align-woes-in-genesis

Here is the solution that I like to use, which filters the entry_image attributes and replaces alignleft with aligncenter.

You simply drop it into your theme functions.php and it’s done!

//* Center Image Alignment for Featured Image
function rjw_center_image_alignment( $attributes ) {
  $attributes['class'] = str_replace( 'alignleft', 'aligncenter', $attributes['class'] );
	return $attributes;
}
add_filter( 'genesis_attr_entry-image', 'rjw_center_image_alignment' );

Kudos to Genesis genius, Bill Erickson, for the code hint!

Screen sharing in OSX Mountain Lion Fix

After upgrading to Apple OSX Mountain Lion, I found that I was unable to connect to the upgraded mac via Screen Sharing any more.

After searching in vain for solutions, in desperation I decided to play with the screen sharing settings in case there was a new option or something.

In the end I was able to get it working again like so:

  1. Open the ‘Computer Settings’ option (System Preferences > Sharing > Screen Sharing)
  2. Change the ‘Anyone May request permission to control screen’ and Save.
  3. Open the ‘Computer Settings’ again and return the setting to it’s original state and Save again.
  4. Stop and start Screen Sharing in the Sharing Screen

It seems that the upgrade may have left the screen sharing settings in an unusable state, and simply re-saving the settings as above was enough to kick it into life again.

Your mileage may vary – but hope putting this ‘out there’ is useful to you too.

Installing the H264 Streaming Module on a cpanel server

The H264 Streaming Module is a webserver plugin that enables HTTP pseudo-streaming – the technology that allows you to jump to any part of a video regardless of whether it has been downloaded yet.

This post is mostly an aide-memoire for us, but putting it ‘out there’ in case it’s useful to others too.

HTTP pseudo-streaming – what is it?

HTTP Pseudostreaming lets you play back MP4 and FLV videos in portions – this means your video viewers can seek to parts of a video which have not yet been downloaded (as you can do on YouTube).

It’s useful for browsers which require flash mode (as HTML5 browsers can pseudo-stream automatically), and because it uses HTTP, your videos will work regardless of firewall settings.

For full information, please see the excellent article on the JW PLayer site.

Installing the H264 Streaming Module on a Cpanel server

1) Login as root to the server via ssh.

2) Switch to your home directory, download and unpack the Module.

cd ~
wget http://h264.code-shop.com/download/apache_mod_h264_streaming-2.2.7.tar.gz
tar -zxvf apache_mod_h264_streaming-2.2.7.tar.gz
cd ~/mod_h264_streaming-2.2.7

NB: This example is for version 2.2.7. Check on the CodeShop website to ensure it is still the latest version 😉

2) Configure and install the module.

./configure
make
sudo make install

The installer will hopefully install in the /usr/local/apache/modules directory, but double check by looking at the information in the last 20 or so lines of the output!

----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/apache/modules

NB: If you get the following error:

** Unrecoverable Error **
The C compiler is not functional and auto repair failed.
Perl module installs require a working C compiler.
Please repair the C compiler and try again.

Chances are it’s a problem with the permissions on the /tmp folder. It should be owned by “root” and have 1777 permissions.
The permissions can be set via:

# chmod 1777 /tmp

 

3) Now include the module in the Apache configuration.

There are two ways to do this – via command line, or via WHM. We’re already in shell, so lets look at that way first.

a) Via Shell, using the vi text editor

vi /usr/local/apache/conf/includes/pre_main_global.conf

One in vi, hit the ‘i‘ key to enter insert mode and paste the following:

LoadModule h264_streaming_module /usr/local/apache/modules/mod_h264_streaming.so
AddHandler h264-streaming.extensions .mp4

NB: If the module was installed in a different directory to /usr/local/apache/modules/ then adjust accordingly!

Now save the file – hit ESC key to exit insert mode, then type the following to save and quit.

:wq

Finally, rebuild the config file and restart apache

/usr/local/cpanel/bin/build_apache_conf
service httpd restart

b) Via WHM

Select “Apache Configuration”

Select “Include Editor”

Under “Pre-Main Include” select “All Versions”.

Enter the following:

LoadModule h264_streaming_module /usr/local/apache/modules/mod_h264_streaming.so
AddHandler h264-streaming.extensions .mp4

NB: Again, checking the path to module is ok.

Select ‘Update’ and follow instruction to restart apache.

4) Finally, if you are using it commercially, you need to get a licence
(€39 for single webserver at time of writing)