Mac OS X 10.6 – MacPorts installs and Drupal

Enterprise works very nicely as a production CMS that users of the system can use to ship content such as articles, images, videos and audios to Web sites (and other destinations for that matter).

If you have been looking at any of the bits that I have put up regarding MacPorts on my Mac you have a pretty good idea that the following is true (at last on my machine):

1. Standard Apache2 that ships with Mac OS X 10.6 is not used by me
2. Apache/PHP is installed on my machine and the installation location is: /opt/local
The ‘htdocs’ directory is at /opt/local/apache2/htdocs’

The problem with my dev environment is that I could not get Drupal to work when installed into the /opt/local/apache2/htdocs directory.

The admin page would work but digging deeper into the site would result in nodes displaying only raw code.

Ugh. Ugly. I got around it by installing Drupal into the standard Mac location but I wanted to install Drupal into my ‘/opt/local/apache2/htdocs’ directory.

How to accomplish this?

After much digging around I found that adding the following directive to the httpd.conf file addresses the situation:

<Directory “/opt/local/apache2/htdocs/drupal”>
AllowOverride All
Options None
Order allow,deny
Allow from all
</Directory>
Drupal now works just fine.

Make sure to check your installation and settings for security, etc.

 

 

 

 

 

Mac OS X 10.6 – Setting up Apache 2.2 and SSL

Note that is part of another article that I have written. See here.

Mac OS X and SSL – Getting SSL running for Development purposes

Someone asked me the other day how to setup SSL on Mac OS X 10.6.

My answer: I have an idea but haven’t done it.

Here’s how I did it.

First of all, know that you need to have mod_ssl compiled with Apache 2.2 (in my case I have Apache/PHP installed via MacPorts. See here.) None of the steps below will be at all useful if mod_ssl is not installed.

Here are the resources that I used:

1. Apple write-up –

2. Macworld – Similiar to Apple write-up

There are two parts to this:

1. Creating the self-signed certificates and keys for mod_ssl and Apache to use

2. Configuring Apache to work with mod_ssl, the certificates and keys

================================

Self-signed certificates

================================

1. Create a directory on the Desktop called ‘KeyGen’

2. Start the Terminal application

3. In Terminal enter: cd ~/Desktop/KeyGen

4. The next step is to create a RSA Private key. The process will ask for a passphrase. During the process enter the passphrase and DON’T LOSE IT.

5. Create a RSA private key by using Terminal and entering: openssl genrsa -des3 -out server.key 1024

6. Create a Certificate Signing Request. This would normally go to a Certificate Authority.

In our case we are self-signing. The process of creating this request requires that you fill in information.

The most important bit of information to fill in is the ‘Common Name’.

This is the ‘Common Name’ of the server at THIS point in the process.

So, for instance, the ‘Common Name’ could be ‘127.0.0.1’ or it could be ‘localhost’. Those are distinct and unique names. Pick one, use it and remember that you used it.

I selected ‘127.0.0.1’.

7. To create the CSR enter into Terminal: openssl req -new -key server.key -out server.csr

8. Here’s the list of information that is requested:

Country Name (2 letter code) [AU]: (enter your country code here)

State or Province Name (full name) [Some-State]: (Enter your state here)

Locality Name (eg, city) []: (enter your city here)

Organization Name (eg, company) [Internet Widgits Pty Ltd]: (enter something here)

Organizational Unit Name (eg, section) []: (enter something here)

Common Name (eg, YOUR name) []: (this is the important one)

Email Address []: (your e-mail address)

Here is what I entered:

Country Name (2 letter code) [AU]:

USState or Province Name (full name) [Some-State]: MI

Locality Name (eg, city) []: Birmingham

Organization Name (eg, company) [Internet Widgits Pty Ltd]: My Company

Organizational Unit Name (eg, section) []: <<blank>>

Common Name (eg, YOUR name) []: 127.0.0.1

Email Address []: me@example.com


9. Now we need to create the Certificate Authority that will then allow us to sign the key.

In Terminal enter:
openssl genrsa -des3 -out ca.key 1024

Enter in a passphrase. I used the same one from above. If you use something different remember it.

10. Time to create the self-signed CA Certificate. You’ll be using the RSA key you just made.

In Terminal enter:

openssl req -new -x509 -days 365 -key ca.key -out ca.crt

NOW…you’ll be asked for the passphrase and then you’ll be asked to fill in some information…just like above.

This one is a bit different. The Common Name this time will be YOUR name and NOT the server name/ip address.

Country Name (2 letter code) [AU]:US

State or Province Name (full name) [Some-State]:MI

Locality Name (eg, city) []:Birmingham

Organization Name (eg, company) [Internet Widgits Pty Ltd]:My Company

Organizational Unit Name (eg, section) []:<<blank<>

Common Name (eg, YOUR name) []: My Name

Email Address []:me@example.com

11. Signing the server.key file with the ca.crt

As we have been progressing through the steps above files have been created in the directory we defined at the beginning of the steps…that is: ~/Desktop/KeyGen.

The next step is to sign the server.key with the ca.crt file.

We need a script to do this. That scripts name is ‘sign.sh’.

The script MIGHT be on your machine but I doubt it. So you need to go get it.

In my case I downloaded the source for mod_ssl for Apache 1.3 (Here: http://www.modssl.org/). Once the source was downloaded I looked into the following path: mod_ssl(version number)/pkg.contrib/sign.sh.

Copy the sign.sh file into the ‘KeyGen’ directory on your desktop.

Run the following command. The first will make the sign.sh file executable and the second will run the script and use the server.csr file.

In the Terminal App (don’t include the ‘Command 1:’ and ‘Command 2:’ text:

Command 1: chmod +x sign.sh

Command 2: ./sign.sh server.csr

A bunch of information will start to appear in the Terminal window.

Enter in your passphrase.

Sign the certificate by pressing the ‘y’ key.

Commit the changes by pressing ‘y’ when asked to.

================================

Setting up Apache 2.2

================================

In the above steps we created the keys and certificates necessary for using SSL with Apache.

The following is a very simple set of steps to get things running.

NOTE: NONE of this setup is for a PRODUCTION server.

1. Move the contents of the KeyGen directory into a accessible location.

My local setup looks something like ‘/opt/local/’ with ‘/opt/local/etc’

What I did is create a directory called ‘httpd’ in the ‘etc’ directory. I then added another directory inside of that called ‘ssl_key’. So the final path to where I stored things is: ‘/opt/local/etc/httpd/ssl_key/’

Copy the contents of the ‘KeyGen’ directory into ‘/opt/local/etc/httpd/ssl_key/’

2. Edit the httpd.conf file
In my case I did two very simple things:

a. Since I compiled Apache with mod_ssl I had the following line in my httpd.conf file: Include conf/extra/httpd-ssl.conf

Uncomment that line by removing the # in front of it.

b. Navigate to the following path: /opt/local/apache2/conf/extra/httpd-ssl.conf

Apache needs to know where the SSL cert is. Find this line: SSLCertificateFile. The default will be something like: SSLCertificateFile “/opt/local/apache2/conf/server.crt.

Change the path to match the location of your server .crt file. In my case the path is something like:
SSLCertificateFile “/opt/local/etc/httpd/ssl_key/server.crt”

We need to tell Apache to listen for SSL connections. Add the following line under the listen command: Listen 443

c. SSL Session CacheLastly we need to tell SSL where to cache session information.

Look for this directive: Inter-Process Session Cache

Change this line ‘SSLSessionCache “dbm:/opt/local/apache2/logs/ssl_scache” so that it is NOT commented out.

================================

Testing

================================

1. Starting and Stopping Apache2

a. Start: /opt/local/apache2/bin/apachectl -k start

b. Stop: /opt/local/apache2/bin/apachectl -k stop

c. Restart: /opt/local/apache2/bin/apachectl -k restart

2. Where to look for errors:Apache will log errors into the ‘error_log’ file located at ‘/opt/local/logs/apache2/error_log’

The only error that I ran into was this one: Invalid method in request

It had to do with the way that I had the .conf file setup. If you get that error take a look at the .conf files.

3. Hitting the server

a. After you have made your .conf file changes restart the server

b. Go to a browser and type in: http://127.0.0.1:443

c. You’ll get a request about the cert. Press ok.

d. You should see in the browser a little lock indicating that the browser is running in secure mode.

 

Mac OS X 10.6 – Installing ImageMagick and Ghostscript using Macports

Here is a bit information that I use in conjunction with my previous article about how to install Apache/PHP/MySQL using MacPorts. Remember to do the steps in the article noted above first.

In addition this post includes a bit of information on doing a brute force change to the ImageMagick plugin for Enterprise to get it to work with this combination. I should really just change the code but haven’t gotten around to that yet.

NOTE: There is one thing to keep in mind here. If you are using Enterprise and running the Server on Mac OS X for Production you should consider the SIPS plugin instead of ImageMagick.

ImageMagick and Ghostscript installation steps

Run the MacPorts ImageMagick install

sudo port install imagemagick

Run the MacPorts Ghostscript Install

sudo port install ghostscript

Once done these applications are installed at: /opt/local. This is IMPORTANT!

That’s all there is for installing ImageMagick and Ghostscript

If you want the ImageMagick plugin to work with this installation make the changes below. Remember that is my brute force method.

The ImageMagick Enterprise server plugin

Go to the ImageMagick Server Plugin located at: /server/plugins/ImageMagick

1. Open ‘ImageMagick.class.php

2. Find the line of code: self::setEnvironment();

3. Comment each line out. Should look like: //self::setEnvironment();

4. Find the function: getVersions().

5. In the function getVersions find the line: $output1 = shell_exec( “convert -version)

6. Change it to: $output1 = shell_exec( “/opt/local/bin/convert -version” );

7. Save.

8. Find the function: convertFile.

9. Comment out the line: $cmdline = “convert”;

10. Add the line: $cmdline = “/opt/local/bin/convert”

11. Go to the Admin area in your browser. Login and go to the Server Plugin page. Turn on the ImageMagick Server Plugin.

 

Mac OS X 10.6 – Installing Apache2/PHP/MySQL using MacPorts

This article will be broken down into the following:

1. Install Apache2/PHP5 using MacPorts (this article)

2. Install ImageMagick and GhostScript (see article here.)

3. Install Tomcat and Solr

4. Get the Apache2/PHP5 setup working with Komodo.

5. SSL and Apache (see article here)

——————————————————————–

Steps for installing Apache2/PHP5 + MySQL on a Snow Leopard machine using MacPorts.

——————————————————————–

In my job I do a lot of different things. Mostly software demonstrations but a bit of development here and there as well. The server part of the system that our company sells is built to run on Apache(or IIS), PHP and MySQL(or SQL Server or Oracle).

When Snow Leopard came out I was faced with a set of problems:

1. I needed Apache/PHP/MySQL installed on my machine

Well, you might ask, Mac OS X comes with all that goodness pre-installed doesn’t it?

The answer to that question is yes…but…there are some other conditions that need to be met:

 

a. The Apple-compiled versions of the software may not meet my needs either through the version installed or through, in the case of PHP, the additional modules that our application requires.

b. Apple updates to Mac OS X can and probably will blow out any changes that I might make to the stock build. That’s not good. I like to update my software.

 

What about using MAMP?

MAMP is a nice choice for development. Download, install and start. Easy. However, I don’t want to use MAMP if the machine is going to be used for Production. In my case I want to replicate the production environment as closely as possible.

So, how do we go about installing new builds of Apache2, PHP5.3 with MySQL support and all the PHP extension we need?

Use MacPorts.

There are 3 steps involved here:

1. Download and install the latest version of XCode

2. Download and install MacPorts

3. Use MacPorts to install the stuff we need.

——————————————————————–

Download and install the latest version of XCode

——————————————————————–

Note that this takes a bit of space on your machine.

This step cannot be avoided.

What is happening is that by installing XCode we are getting access to the compiler that MacPorts needs to be able to compile the stuff (Apache2, PHP, etc…) we are going to be installing.

1. Go to http://developer.apple.com

2. Download the latest version of XCode (comes as .dmg file that is quite large)

3. Install XCode by opening the .dmg file and running the installer. You don’t need to change any of the options that are selected.

——————————————————————–

Download and install MacPorts

——————————————————————–

1. Go to the MacPorts web site and download the latest MacPorts installer (a .dmg file) for Snow Leopard.

The web site address is: http://www.macports.org/install.php

There is a key point to note in the instructions. That is the point about the ‘selfupdate’ command. This command keeps the list of ‘portfiles’ on your machine up to date with the list of current ‘ports’ available.

After the installer is done go ahead and finish the installation.

Start the ‘Terminal’ application and type in:

sudo port -v selfupdate.

Press return. A request to enter a password will appear. Keep in mind that the ‘sudo’ command is overriding your standard privileges and allowing the Terminal command to act with your Administrator privileges.

MacPorts will update itself. Note that it writes out what it is doing in the Terminal window.

———————————-

Install PHP5

———————————-

In this step we are going to tell MacPorts to install PHP5 (at the time of this writing the version of PHP available via MacPorts is 5.3.2). This command will also install any dependencies that PHP5 needs. That includes, in this case, Apache2.

MacPorts will install, by default, into the /opt directory. That directory will be created at the root of your hard disk.

When you are ready enter the following commands into the Terminal window.

NOTE:

1. Each command is telling MacPorts to go out to a Internet location, download the necessary files to compile the app or extension and then perform the compile and install the app. Hence Internet access is required

2. Each command will list out what it is doing as it performs each step. Pay attention! Watch for errors.

3. It take some time to download and compile this stuff. Don’t get impatient.

—————————————————————————

Initial Terminal command to install PHP5

—————————————————————————

sudo port install php5

————————–

Install php5 MySQL support

————————–

sudo port install php5-mysql

sudo port install php5-sqlite

————————–

Install php5 support for other stuff. Your needs may vary.

————————–

sudo port install php5-sockets

sudo port install php5-mcrypt

sudo port install php5-mbstring

sudo port install php5-imagick

sudo port install php5-xdebug

sudo port install php5-xmlrpc

sudo port install php5-xsl

sudo port install php5-zip

sudo port install php5-soap

sudo port install php5-gd

sudo port install php5-exif

sudo port install php5-openssl

sudo port install php5-iconv

 

I wrote a little Javascript for Enterprise

One of our partners asked if Enterprise had a feature that allowed the user to check out all of the articles that were attached to a layout in one move.

Answer: No

BUT…we do have our friend javascript AND in addition to that we have ‘Before’ and ‘After’ Events for the Enterprise plugins

So, the script below can be used in one of two ways.

Add the script to the Script Panel in InDesign and when the user WANTS to check out all of the articles…use the script by running it.

Or it could be tied to ‘AfterOpenLayout’ event. This would check out all of the article every time a layout was checked out.

You decide.

//////////////////////////////////////////////////////////////////////////////
// Script: Checkout articles on layout
// Language: JavaScript
// Author: jag
// Company: WoodWing USA
// Date: 18 January 2010
//////////////////////////////////////////////////////////////////////////////
// Description: When this script is invoked it will check out all of the articles
// attached to the targeted layout
//////////////////////////////////////////////////////////////////////////////
try
{
// Identify the current document
var doc = app.documents.item(0);
// Access the document’s articles
var mas = doc.managedArticles;
//Count the number of managed articles
var countOfManagedArticles = doc.managedArticles.count();
if ( countOfManagedArticles > 0)
{
for( var i = 0; i < countOfManagedArticles; ++i)
{
var getTheMetaData = doc.managedArticles.item(i).checkOut();
}
}
} catch( e)
{
desc = e.description;
num = e.number;
alert( “Check out article script error ” + num + “: ” + desc );
}

Mac OS X 10.5 – Installing the latest version ImageMagick and Ghostscript using MacPorts

The caveat with this post is….I assume you know what the heck you are doing…

Download and install MacPorts

  1. Go to here: http://www.macports.org/install.php
  2. Download the Leopard (Universal) .dmg file
  3. Open the .dmg file and run the installer package.

MacPorts is command line application. There will not be any application installed directly into the /Applications directory

Make one modification to the MacPort config scripts

Macports installs itself into a directory called /opt and places a configuration file at this location: /opt/local/etc/macports/macports.conf

To make sure that both GhostScript and ImageMagick install into the correct directory so that Apache and PHP can use the applications we need to change this configuration file. Use either TextWrangler or Pico(terminal) to open this file.

Find the section of the file labeled:

# Set the directory in which to install ports
prefix /opt/local

Modify the file so that it reads:

# Set the directory in which to install ports
prefix /usr/local

Save and close the file.

Install ImageMagick

  1. Start Terminal
  2. Type into the terminal window: sudo port install ImageMagick
  3. MacPorts will grab the necessary pieces and compile, build and install ImageMagick into the following directory: /usr/local/

That’s it.

Install Ghostscript

  1. Start Terminal
  2. Type into the terminal window: suod port install ghostscript
  3. MacPorts will grab the necessary pieces and install ghostscript into the following directory: /usr/local/

Changing Issue Information in Enterprise

One of our customers was asking what the best practices were in moving assets from one scheduled issue to another. They were discussing moving layouts from issue to issue but I wanted to insure that they were prepared for using the multi-channel aspects of Enterprise.

Note that, of course, moving layouts around is easy to do…just not the best practice.

  1. Layouts can only be assigned to ONE issue. No more. Either a Print channel or Tablet Channel.
  2. All other object types such as Articles, Images, Video, etc can have ONE or MORE channel/issue combinations. These channels might include ‘Print’, ‘Tablet’, ‘Web’, ‘Facebook’.
  3. Layouts do NOT inherit the Issue of the Dossier they are in.
  4. Articles and Images WILL inherit the ‘print’ issue of the Dossier they are in.
  5. Articles and Images WILL inherit the issue of the layout they are attached to.
  6. Changing the Print issue that a dossier is assigned to WILL change the issue of the layout IF the Layout is in the same issue as the Dossier at the time of the change.
  7. If the Layout has a different Issue assignment than the Dossier then the Issue date of the layout will NOT change. The net result of this is that the ‘Issues’ column in the views will show multiple issues assigned for Articles, Images and other files.
  8. Changing the Issue of the layout will change the Issue of the attached articles and images.

Because of the above there are scenarios where a user could change the Issue of a layout in the ‘Properties’ dialog and depending on the view and filters applied in the Smart Connection palette the user may or may not see the layout (and attached objects).

The end result is that the ‘Dossiers’ should be moved between Issues and not Layouts.

Best Practices

  1. Consider Dossiers as the ‘article’ or ’section’ containers. Keep in mind that more than one layout/article can exist in a Dossier. When you start doing tablet production you may wish to have more dossier/layout combinations to help with navigation of content.
  2. Only change the Issue on a Dossier. Doing so will change the Issue on all the other objects such as layouts and articles. Following this suggestion will greatly simplify things.
  3. Use Content Station to change the Issue of the Dossier. This can be done in the Planning application by dragging the Dossier from one issue to another, by searching for the Dossier and invoking the ‘Properties’ dialog or by opening up a tab for the Dossier and using the ‘Dossier Properties’ dialog.

Examples

Example Enterprise configuration
Issue 1 -> August 20th (print channel)
Issue 2 -> Sept 4th (print channel)

We now want to ‘move’ the Dossier from ‘August 20th’ to ‘Sept 4th’.

Example 1 – Using the Planning App in Content Station

  1. Start Content Station and start the Planning app. The ‘August 20th’ and ‘Sept 4th’ issues should be listed on the left.
  2. Select the ‘Sept. 4th’ issue. The Dossier from ‘Example 1’ will be listed in the middle.
  3. Click, hold and drag the Dossier from the list in the middle to the ‘August 20th’ issue in the left hand panel. Let go of the Dossier when the ‘Issue’ listing ‘accepts’ the drag.

Result

In the planning app show the ‘issues’ column. The issue for all of the assets will be set back to Sept 4th.

Example 2 – Finding a Dossier and changing the Issue properties

  1. Start Content Station and log in. Start the ‘Search’ app. Set the popup values to the appropriate brand and current issue of the Dossier you want to change the issue on and set the ‘object type’ popup to ‘Dossier’
  2. Find the Dossier you want to change the issue on in the list.
  3. Select the Dossier and bring up the contextual menu. Select ‘Properties’.
  4. Find the ‘Publish In’ area. Select the new Issue from the list. Press Ok.

Result

The issue value will change for all the assets.

References
WoodWing Community Site 

RAW files, ImageMagick and WoodWing Enterprise

Recently I had a partner that I was working with who asked the following question:

“How can Enterprise accept RAW files and build large usable previews?”

Good question.

Disclaimer

This set of explanations and instructions assume that you have a certain level of skills that allow you to compile some server tools, modify Enterprise config and Server Plugin files.

In addition, since we are modifying the stock Enterprise installation you NEED to have a plan in place that will allow you to propagate the changes you are making to newer versions of Enterprise as updates and upgrades are released.

What are RAW files?

The best explanation that I can give is that a RAW file is exactly what the image sensor recorded at the time the image was taken UNAFFECTED by any processing. I think of a RAW file as a digital negative. (Don’t confuse that term with Adobe’s DNG stuff…that’s for another post!)

When I first heard people talk about ‘RAW’ files I thought that implied that there was one file type. Not true. Each camera manufacturer creates a RAW file type that then has a file extension defined by the camera manufacturer. A tool like Photoshop understands how to interpret the file but in the end will want to write out to something like the .psd or jpeg formats.

See more here: http://en.wikipedia.org/wiki/Raw_image_format

In my case the sample files include extensions like .NEF, .CR2 and .IIQ

Image files and WoodWing Enterprise

WoodWing Enterprise uses several different mechanisms to deal with image formats.

The GD module that can be compiled with PHP is the first candidate to take a look at.

However, I know that GD does not support ‘RAW’ files. GD supports JPEG, GIF, PNG, SWF, TIFF and JPEG2000 files. If you want to see what your installation is set up to support take a look at how by reviewing this page: http://www.php.net/manual/en/function.gd-info.php

A second option is to use SIPS (Scriptable Image Processing Server). Using SIPS with Enterprise requires that:

The Enterprise server be running on Mac OS X.
The SIPS Enterprise Server plugin is installed (available on the Community site and free).
SIPS was designed by Apple to provide tools for performing basic image alterations and support for various image formats. It is a OS level tool and support includes these image file types:

jpeg, tiff, png, gif, jp2, pict, bmp, qtif, psd, sqi, tga.

As you can see it doesn’t look like RAW files are supported here either.

That leaves the last ‘standard’ choice: ImageMagick

A quick review of this page clues me that all of the sample file formats (.NEF, .CR2 and .IIQ) are supported by ImageMagick

ImageMagick and RAW files

How are ‘RAW’ files supported by ImageMagick?

They are supported by using ‘ufraw’ (Unidentified Flying Raw) which is an open-source tool that allows for working with RAW files such as those from Canon, Nikon, Pentax, Samsung, Sony, Fuji and even Adobe. Here’s the web site: http://ufraw.sourceforge.net/index.html

Most installations of ImageMagick will probably NOT have ufraw so you will have to install it so that ImageMagick can work with it.

Installing ufraw…or in my case re-installing ImageMagick and then installing ufraw

In other parts of this web site you will find entries that refer to my Mac using MacPorts. I have installed PHP5/ImageMagick using this tool and find it easy to use. Keep in mind that you have to have ImageMagick installed if you are going to use ufraw with Enterprise.

To install ‘ufraw’ using MacPorts start ‘Terminal’ and enter:

sudo port install ufraw

Hit return and enter your password.

That should do the trick. Unless, of course, you are me. I had to do a variety of messing around with MacPorts that included uninstalling a series of unused port versions before I could finally get this installed.

Once MacPorts has worked its wonders you will be left with an installation that has ‘ufraw’ installed.

Enterprise and MIME Types

Out of the box Enterprise handles a LOT of file types. This is a case, however, where we have to add a MIME type to the system so that it can handle the files.

There are a variety of file types that are considered RAW files but for this example we are going to deal with three: .nef, .cr2 and .pef

Assuming you know how to work with Enterprise at the level where you can edit the configuration files take the following steps…assuming YOU HAVE MADE A BACKUP!

Open the configserver.php file and navigate to the section labeled ‘extensionmap’. Add the following line:

‘.nef’ => array( ‘image/x-nikon-nef’, ‘Image’),
‘.cr2’ => array( ‘image/x-canon-cr2’, ‘Image’),
‘.pef’ => array( ‘image/x-pef’, ‘Image’),

Be careful here and make sure that you follow the conventions laid out in the file. I.E. if you screw up the array your users will know very quickly.

Making these changes tells Enterprise that it can handle the indicated file extension, that the MIME type for the file extension is ‘image/xxx’ and that the file type will be a ‘Image’ when uploaded to Enterprise.

The Enterprise ImageMagick Server Plugin (which ships free with Enterprise)

Right now, with the MIME type added to configserver.php you can upload the RAW files to Enterprise and they will upload and be usable. The problem is that there will still not be a preview associated with the file.

We have to make a few changes in the plugin. We have to first change a file so that plugin recognizes that it can deal with our new MIME types. Then we have to change the code a bit so that a preview can be extracted from RAW files and uploaded to Enterprise.

Changing the ImageMagick_Preview.class.php file

To modify the plugin you will need to go your Enterprise installation to /server/plugins.

Open the directory labeled ‘ImageMagick’. Inside of that directory find the file labeled ‘Imagemagick_Preview.class.php’. Open this file with a text editor.

Find the area labeled ‘canHandleFormat’. This is a function that tells the plugin how to handle a variety of formats. Add the following:

case ‘image/x-nikon-nef’:
case ‘image/x-canon-cr2’:
case ‘image/x-pef’:

Save and close the file.

What would our results be at this point?

Right now, with the configuration that has been done up to this point and the installation of ufraw Enterprise will give you a 160 x 120 preview of uploaded images. Generally that’s not going to work for most uses as the preview is to small.

How can we get a larger preview? That is going to take a bit more work. This will include modifying the Enterprise ImageMagick server plugin a bit more.

Changing the ImageMagick.class.php file

The changes here are a bit…tricky.

What we have modify this code to look for a specific set of MIME types. If the MIME type is found we then have to process the file, extract the preview from the RAW file and write it to disc so that Enterprise can upload it.

It’s the extraction part that is a bit tricky. Enterprise/ImageMagick cannot extract the preview without the help of a program called exiv2.

The exiv2 tool is pretty cool in that it has a command that will pull the jpeg preview out of the RAW file and write it to disc. In general RAW files will contain up to 3 previews. One preview will be small, one medium and one large.

In the case of my sample file I have the following:

Preview 1: image/tiff, 160×120 pixels, 57600 bytes
Preview 2: image/jpeg, 570×375 pixels, 113163 bytes
Preview 3: image/jpeg, 4288×2848 pixels, 813532 bytes

Note: you can get the above output by entering the following into ‘Terminal’:

exiv2 -pp /filename.extension

Once we have asked exiv2 to extract the preview we’ll need replace the preview that Enterprise extracted with preview exiv2 extracted.

Instead of laying out the code to do this here I will post it in WoodWing’s community forum

Testing preview generation

Make sure the ImageMagick Server plugin that you have modified is loaded by going to the Enterprise Admin area. Navigate to the ‘Server Plugins’ area and make sure that the ‘ImageMagick’ plugin is loaded.

Start up Content Station. Find a Dossier. Drag a .nef file (or other RAW file depending on your configuration) to the Dossier so that you get a upload dialog. Set the meta data and press ‘OK’.

The file will upload and a preview will be created.

Memory and large files

One thing about RAW files is that they can be quite large. Make sure that the setting PHP’s php.ini file are set correctly to allow Enterprise to upload files of this size. This should have been part of the initial configuration of Enterprise but check it anyway.

Mac OS X 10.8, MacPorts and WoodWing Enterprise

Hello!

FYI: This works for Enterprise 9 as well.

Several years ago (almost exactly two years ago as I write this) I wrote a post for installing WoodWing’s Enterprise Content Management system onto a Mac running Mac OS X 10.6 (see here).

Just recently I got a new machine and, of course, I need to install all these bits and pieces again so that I can run Enterprise v8 on my machine.

Below are the steps that I followed. This assumes that this is a new machine running Mac OS X 10.8.x

Preparation

I generally have to do a few things to prepare a new machine as I generally don’t like to migrate things from the old machine.

To get prepared for this I had to do the following:

1. I create the non-Admin user for security reasons.

2. Install TextWrangler

I install TextWrangler on any machine that I spend time on where I’m installing software. It has code coloring and outside of BBEdit is my favorite text editors.

3. Install Apple’s Xcode

Xcode is required for MacPorts to be able to compile the bits and pieces we are going to need.

To get Xcode go to the App Store, download and install it.

Once Xcode is installed there are still some components that need to be installed so that we can compile stuff.

Start Xcode, select the ‘Xcode’ menu at the top and select ‘Preferences’. In the preferences screen select ‘Downloads’.

‘Command Line Tools’ should be listed. Press the ‘Install’ button and watch the magic.

4. Install MacPorts.

Download the latest MacPorts installer from here (http://www.macports.org).

Be sure to get the right one for your operating system. The installer comes as a .dmg file. Open the file and run the installer. Read more here.

After installation I open the ‘Terminal’ application and enter the following command:

sudo port -v selfupdate

MacPorts will update, if necessary, and then it is ready to use.

You will also want to get the path information to your profile run the following commands in Terminal to do so:

export PATH=/opt/local/bin:/opt/local/sbin:$PATH
export MANPATH=/opt/local/share/man:$MANPATH
Install Apache2, PHP and MySQL

Installing MySQL

1. Start Terminal

2. Run the following command to install MySQL v55

sudo port install mysql55

If you want MySQL to start up on start of the machine run:

sudo port install mysql55-server

Then the command below to get the initial databases installed:

sudo -u _mysql /opt/local/lib/mysql55/bin/mysql_install_db

To get your server to start when the machine starts up:

sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql55-server.plist

You might run into this: Starting MySQL… ERROR! The server quit without updating PID file
See here.
Installing PHP5

Note that Apache2 will get installed by issuing the command below.

The command to install php5 is: sudo port install php5

NOTE: We could do a command that would install PHP5 and all of the other necessary bits. Instead, below I have outlined the individual port commands below.

sudo port install php5-mysql
sudo port install php5-sqlite
sudo port install php5-sockets
sudo port install php5-mcrypt
sudo port install php5-curl
sudo port install php5-mbstring
sudo port install php5-imagick
sudo port install php5-xdebug
sudo port install php5-xmlrpc
sudo port install php5-xsl
sudo port install php5-zip
sudo port install php5-soap
sudo port install php5-gd
sudo port install php5-exif
sudo port install php5-openssl
sudo port install php5-iconv
sudo port install php5-ftp

Set up Apache2 to start up automatically

Use Terminal and issue this command:
sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist

You may need to set the server name in the ‘httpd.conf’ file to something like:

ServerName 127.0.0.1:8080

Starting Apache

There are two commands that you will need if you are making adjustments to Apache or PHP config files.

Start Apache:
sudo /opt/local/apache2/bin/apachectl -k start

Stop Apache:
sudo /opt/local/apache2/bin/apachectl -k stop

Installing Enterprise
Follow the admin guide provided on the Community site.

WoodWing and CentOS 6.4

Spent some time bringing up a CentOS 6.4 VM that ran Enterprise and Elvis.

Had to install a few things on the Apache/PHP/MySQL front. Below are the commands that I ran to to get things running for Enterprise.

Keep in mind that your mileage will vary here as how you installed CentOS (For instance did you make the selection to install a ‘Web Server’ when running the installer) will make a big difference on what you have to do.

After you have created the VM (In my case I used Parallels because…that’s what I had).

CentOS 6.4

Install the base goodies.

yum -y install httpd php mysql mysql-server php-mysql

For PHP I had to install a few other extensions:

mbstring
yum install php-mbstring

mcrypt
To get this installed I had to reference another repository and then run the command. Be sure to check the link below to make sure you are getting the correct version.

a. ‘rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

b. yum install php-mcrypt

References:

maxwhale.com

imagick
Need to install php-pear and gcc (should already be installed)

yum install php-pear gcc

yum install ImageMagick

References:

tecmint.com

xmlrpc
yum install php-xmlrpc

php-soap
yum install php-soap

Install PHPMyAdmin

I installed PHPMyAdmin to work with MySQL. I like the tool. Easy to install and use.

Enterprise configuration changes

You’ll need to make one change to the server config files for the ‘locale’ setting.
a. Open ‘config.php’

b. Add setlocale(LC_ALL,”en_US.utf8″);’ after file encoding section at the bottom of the file.

References:

WoodWing Community Site article about ‘locale’ setting