$r['name'] = str_replace('\'', '`', $r['name']); $r['tag'] = str_replace('\'', '`', $r['tag']); $r['album'] = str_replace('\'', '`', $r['album']); $r['photos'] = array(); $r['createTime'] = date("Y-m-d H:i:s", $r['createTime']); $r['thumbnail'] = "/images/{$r['tag']}/{$r['name']}.jpg"; $r['thumbnailrate'] = 1; if (file_exists(__DIR__ . "/../source/{$r['thumbnail']}")) { list($width, $height) = getimagesize(__DIR__ . "/../source/{$r['thumbnail']}"); $r['thumbnailrate'] = sprintf("%.2f", $width / $height); $r['thumbnailsmall'] = "/images/{$r['tag']}/{$r['name']}.small.jpg"; if (!file_exists(__DIR__ . "/../source/{$r['thumbnailsmall']}")) { if ($r['thumbnailrate'] > 1.33) { list($thumbnail) = scaleImageFileToBlob(__DIR__ . "/../source/{$r['thumbnail']}", 0, 200); } else { list($thumbnail) = scaleImageFileToBlob(__DIR__ . "/../source/{$r['thumbnail']}", 266, 0); } file_put_contents(__DIR__ . "/../source/{$r['thumbnailsmall']}", $thumbnail); } } $name = addslashes($r['name']); $createTime = $r['createTime']; $updateTime = $r['updateTime']; $tag = addslashes($r['tag']); $album = addslashes($r['album']); $sizef = addslashes($r['sizef']); $md = <<<EOT title: '{$name}' date: '{$createTime}' updated: '{$updateTime}' categories: '{$tag}'
Your Photo: (jpeg only)<input type="file" name="photo" size="25" /></td> </tr> <tr> <td> <input type="reset" value="Reset" > </td> </tr> </form> </table> <?php } else { $image = addslashes($_FILES['photo']['tmp_name']); $name = addslashes($_FILES['photo']['name']); $image = file_get_contents($image); $image = base64_encode($image); $thumbnail = scaleImageFileToBlob($_FILES['photo']['tmp_name']); $thumbnail = base64_encode($thumbnail); $conn = connect(); $stmt = oci_parse($conn, "select * from idtracker"); oci_execute($stmt); oci_fetch($stmt); $id = oci_result($stmt, 'IMAGE_ID'); //found is implemented with use of http://php.net/manual/en/function.oci-new-descriptor.php $lob = oci_new_descriptor($conn, OCI_D_LOB); $lobimage = oci_new_descriptor($conn, OCI_D_LOB); //used to save blob $stmt = oci_parse($conn, "insert into images (image_id, sensor_id,date_created,description,thumbnail,recoreded_data)\n\t\t\t\t values (" . $id . ", " . $_POST['sid'] . ",to_date( TO_CHAR(SYSDATE, 'DD/MM/YYYY HH24:MI:SS') , 'DD/MM/YYYY HH24:MI:SS' ),'" . $_POST['des'] . "',EMPTY_BLOB(), EMPTY_BLOB()) \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t returning thumbnail, recoreded_data into :thumbnail, :recoreded_data"); $id += 1; oci_bind_by_name($stmt, ':thumbnail', $lob, -1, OCI_B_BLOB); oci_bind_by_name($stmt, ':recoreded_data', $lobimage, -1, OCI_B_BLOB); @oci_execute($stmt, OCI_NO_AUTO_COMMIT);