Headcrop flash

Ever needed a tool to crop a head, face or shape from a photo? Here is an working example to get you started.

Download here

qTranslate admin language

None of the wordpress admin locale switcher plugins work, when you are using qTranslate and qTranslate does not have a separate option for admin locale, therefore to specify any other locale then the default content locale you’ll have to add the code below to qtranslate/qtranslate_hooks.php:

 * This filter hook allows wordpress admin locale to be
 * different then your default qTranslate content language
function qtrans_mofileFilter($mofile) {
	// replace "en_US" with your preferred admin language
	if (is_admin() || is_login())
		return WP_LANG_DIR."/en_US.mo";
	return $mofile;
add_filter('load_textdomain_mofile', 'qtrans_mofileFilter', 0);

function is_login() {
	return in_array($GLOBALS['pagenow'], array('wp-login.php', 'wp-register.php'));

tested with WordPress version 3.2.1 and qTranslate version 2.5.24

Show image thumbnails in plupload queue widget

Modified plupload flash runtime.

This was for plupload version 1, the new version 2 comes with thumbnails already.

After selecting an image thumbnail get loaded (on the client side):

Use Photoshop scripting to export JPEGs from PSD

// configuration
var exportExtension = "jpg"; // extension jpg or png
var exportPath = "/Users/kasparsj/Work/someproject/images"; // set to your project path

app.preferences.RulerUnits = Units.PIXELS;
var doc = app.activeDocument;
var html = '';
var exportOptions = new ExportOptionsSaveForWeb();
exportOptions.quality = 80; // set quality
if (exportExtension == "jpg") {
  exportOptions.format = SaveDocumentType.JPEG;
else {
  exportOptions.format = SaveDocumentType.PNG;

// do it!

// loops trough all layers and processes visible Art Layers
function processLayerSet(layer) {
  for (var i=0; i<layer.layerSets.length; i++) {
    if (layer.layerSets[i].visible) {

  for (i=0; i<layer.artLayers.length; i++) {
    if (layer.artLayers[i].visible) {
      processArtLayer(layer.artLayers[i], i);

function processArtLayer(layer, index) {
  // copy layer
  doc.activeLayer = layer;
  // create new doc, paste and crop
  var newDoc = app.documents.add(1920, 1080, 72, layer.name);
  // save new doc
  newDoc.exportDocument(new File(exportPath+"/"+layer.name+"."+exportExtension), ExportType.SAVEFORWEB, exportOptions);

function intersectSelectionWithTransparency(){
  var desc = new ActionDescriptor();
  var ref = new ActionReference();
  ref.putEnumerated( charIDToTypeID( "Chnl" ), charIDToTypeID( "Chnl" ), charIDToTypeID( "Trsp" ) );
  desc.putReference( charIDToTypeID( "null" ), ref );
  var ref1 = new ActionReference();
  ref1.putProperty( charIDToTypeID( "Chnl" ), charIDToTypeID( "fsel" ) );
  desc.putReference( charIDToTypeID( "With" ), ref1 );
  executeAction( charIDToTypeID( "Intr" ), desc, DialogModes.NO );