I have now managed to combine the 2 scripts and get them working together.

However I have one very strange problem.

- The function of the first script is to upload an image, create 2 new sizes of it and store all 3 images in separate directories on the server.

- The function of the second script is to read the Exif data from an image specified in the script and to then display the image and the exif data in a formatted page.

Independently these scripts work perfectly.

I have now modified the first script on completion of upload and storage of the image to load the location and name of the stored original image as a variable and then to run the second script.

I modified the second script to load the variable from the first script to identify the image to process instead of using a hard coded reference to the image and location.

The new combined script works as required EXCEPT for one problem.

In the second script, once the exif data is loaded from the image there is a calculation done on 2 of the elements and the results of the calculation are then displayed.

The results of this calculation are missing when I run the new script, but they show perfectly if I run the original script using hard coding to point to the same image the combined script uses.

The ONLY change I made to the second script was to the image location:

This in the stand alone version:

- Code: Select all
`// --- Change the 'image1.jpg' value below to the path of your file. --- //`

$Image = 'original/test.jpg';

// --- Read EXIF Data --- //

$exif = exif_read_data($Image, 0, true);

// --- The EXIF GPS Conversion Degrees to Decimal --- //

function toDecimal($deg, $min, $sec, $hemi) {

$d = $deg + $min/60 + $sec/3600;

return ($hemi=='S' || $hemi=='W') ? $d*=-1 : $d;

}

function divide($a) {

$e = explode('/', $a);

if (!$e[0] || !$e[1]) {

return 0;

} else {

return $e[0] / $e[1];

}

}

function getGPS() {

global $exif;

if ($exif) { $lat = $exif['GPS']['GPSLatitude'];

$log = $exif['GPS']['GPSLongitude'];

if (!$lat || !$log) return null;

$lat_degrees = divide($lat[0]);

$lat_minutes = divide($lat[1]);

$lat_seconds = divide($lat[2]);

$lat_hemi = $exif['GPS']['GPSLatitudeRef'];

$log_degrees = divide($log[0]);

$log_minutes = divide($log[1]);

$log_seconds = divide($log[2]);

$log_hemi = $exif['GPS']['GPSLongitudeRef'];

$lat_decimal = toDecimal($lat_degrees, $lat_minutes, $lat_seconds, $lat_hemi);

$log_decimal = toDecimal($log_degrees, $log_minutes, $log_seconds, $log_hemi);

return array($lat_decimal, $log_decimal);

} else{

return null;

}

}

This is the modified version;

- Code: Select all
`// --- Change the 'image1.jpg' value below to the path of your file. --- //`

$Image = $Image99;

// --- Read EXIF Data --- //

$exif = exif_read_data($Image, 0, true);

// --- The EXIF GPS Conversion Degrees to Decimal --- //

function toDecimal($deg, $min, $sec, $hemi) {

$d = $deg + $min/60 + $sec/3600;

return ($hemi=='S' || $hemi=='W') ? $d*=-1 : $d;

}

function divide($a) {

$e = explode('/', $a);

if (!$e[0] || !$e[1]) {

return 0;

} else {

return $e[0] / $e[1];

}

}

function getGPS() {

global $exif;

if ($exif) { $lat = $exif['GPS']['GPSLatitude'];

$log = $exif['GPS']['GPSLongitude'];

if (!$lat || !$log) return null;

$lat_degrees = divide($lat[0]);

$lat_minutes = divide($lat[1]);

$lat_seconds = divide($lat[2]);

$lat_hemi = $exif['GPS']['GPSLatitudeRef'];

$log_degrees = divide($log[0]);

$log_minutes = divide($log[1]);

$log_seconds = divide($log[2]);

$log_hemi = $exif['GPS']['GPSLongitudeRef'];

$lat_decimal = toDecimal($lat_degrees, $lat_minutes, $lat_seconds, $lat_hemi);

$log_decimal = toDecimal($log_degrees, $log_minutes, $log_seconds, $log_hemi);

return array($lat_decimal, $log_decimal);

} else{

return null;

}

}

$gps = getGPS();

$Image99 in the second set of code is the location of the image defined as a variable in the upload part of the script - and is the same image used in the standalone script.

So - can anyone point me in the direction of how to locate the problem with the combined script.

Here's hoping for some guidance.