<?php require_once dirname(__FILE__) . '/initApi.php'; $CUR_FILE = ''; $ACTION = ''; if (isset($_GET['file'])) { $CUR_FILE = urldecode($_GET['file']); } if (isset($_GET['action'])) { $ACTION = $_GET['action']; } if ($ACTION == 'remTag') { removeTag($CUR_FILE, $_GET['tag']); } else { if ($ACTION == 'addTag') { addTag($CUR_FILE, $_GET['tag']); } else { if ($ACTION == 'getTags') { echo json_encode(extractTagsFromFile($CUR_FILE)); } else { if ($ACTION == 'getGeoLoc') { echo json_encode(extractGps($CUR_FILE)); } } } }
function importImage($_path, $_fileName, $_folderId) { $coords = extractGps($_path . '/' . $_fileName); $exifDatas = readExifFromFile($_path . '/' . $_fileName); $date_crea = ''; $iso = 0; $aperture = ''; $exposure = ''; if (isset($exifDatas['DateTimeOriginal'])) { $date_crea = $exifDatas['DateTimeOriginal']; $date_crea = explode(' ', $date_crea); $date_crea[0] = str_replace(':', '-', $date_crea[0]); $date_crea = $date_crea[0] . ' ' . $date_crea[1]; } if (isset($exifDatas['ISOSpeedRatings'])) { $iso = $exifDatas['ISOSpeedRatings']; } if (isset($exifDatas['ApertureValue'])) { $aperture = $exifDatas['ApertureValue']; } if (isset($exifDatas['ExposureTime'])) { $exposure = $exifDatas['ExposureTime']; } $sql = 'INSERT INTO files (folder_id, path, filename, lat, lon, exif_date_crea, exif_iso, exif_aperture, exif_exposure_time) VALUES(' . $_folderId . ', "' . clean_champ($_path) . '", "' . clean_champ($_fileName) . '", ' . $coords['lat'] . ', ' . $coords['lon'] . ', "' . $date_crea . '", ' . $iso . ', "' . $aperture . '", "' . $exposure . '")'; mysql_query($sql); $imageId = mysql_insert_id(); makeThumb($imageId, $_path . '/' . $_fileName, 'h', 200, dirname(__FILE__) . '/../thumbs/' . $_folderId); importImageTags($_path . '/' . $_fileName); linkImageTags($imageId); return $imageId; }