Posts By Tony Gillilan

New Gallery soft launch

New Gallery soft launch

Today, I launched the early “beta” build of my new gallery. It is sparse, but it is functional. My goal is and has always been to control the SEO and page design in such a way that google likes it better than the gallery sites I have tried in the past such as SmugMug, Zenfolio, Flickr, etc. We will see in the long run if it works or not. Either way, I have enjoyed the coding process. As I build each line of code, I have been able to decide exactly how I want things. Hopefully this will be fun.

New gallery coding almost complete

New gallery coding

I have spent several hours this past week building the upload code, the resampling code – that was a giant task – and the watermarking routine. I have most of the difficult coding behind me and now I just have some basic html and logic left in addition to putting it all together. I should have a bare bones gallery up and running in the next day or so.

PHP ExifTool

php logo

Here is a great example of Php Exiftool.

/*==========================================================================
	read exif from exiftool from image into raw array
	two different ways to do it here depending on what you like
============================================================================*/
//exec('exiftool -s ' . '"' . $path_to_image . '"', $exif_raw_array);   
// note the -s flag returns tags with no spaces -n removes data formatting will work with either or none

exec('exiftool -s -n -Orientation -ImageWidth -ImageHeight -Title -ImageDescription -Keywords -Copyright -Artist -Make -Model -LensModel -FocalLength -FocalLengthIn35mmFormat -ShutterSpeedValue -ApertureValue -ISO -DateTimeOriginal -City -State -Country -Location -GPSSpeed -GPSAltitude -GPSLatitude -GPSLongitude ' . '"' . $path_to_image . '"', $exif_raw_array);

/*==========================================================================
	extract tagname and tagname value from raw array
============================================================================*/
// note var_dump(exif_raw_array) to visualize what needs to be done
foreach ($exif_raw_array as $key => $value)  {
	
$string_length_of_value_field = strlen($value); // need string length for calculation below
$position_of_colon = strpos($value, ':'); //get the position of the colon to use in calculation below


$exiftool_tagname = substr($value, 0, $position_of_colon); // shorten the full string starting at position 0 and ending at the colon
$exiftool_tagname = ltrim($exiftool_tagname); // trim any white space on the left that may exist
$exiftool_tagname = rtrim($exiftool_tagname); // trim any white space on the right that may exist
// done - now have $exiftool_tagname extracted by itself


// same technique as above just extracting the other end of the string
$exiftool_tagname_value = substr($value, ($position_of_colon+1), ($string_length_of_value_field-$position_of_colon));
$exiftool_tagname_value = ltrim($exiftool_tagname_value);
$exiftool_tagname_value = rtrim($exiftool_tagname_value);
// done - now have $exiftool_tagname_value extracted by itself


/*==========================================================================
	enter variables into exiftool_final_array with predictable fields
============================================================================*/
$exiftool_final_array[$exiftool_tagname] = $exiftool_tagname_value;


/*==========================================================================
	end of exif_raw_array loop
============================================================================*/
}

/*==========================================================================
	destroy exif_raw_array - no need to keep in memory
============================================================================*/
unset($exif_raw_array);
/*==========================================================================
	done - new clean array is ready to use - try var_dump($exiftool_final_array)
	to see
============================================================================*/