Esempio n. 1
0
function image_delete($pid)
{
    $cn = connect_db();
    $sql = "SELECT * FROM `photo` WHERE id='" . $pid . "'";
    $link = mysql_query($sql, $cn) or die("Error : " . mysql_error());
    $data = mysql_fetch_assoc($link);
    $path = str_replace(get_domain_path(), "", $data['original_url']);
    unlink(get_full_domain_path() . $path);
    //	$path=str_replace(get_domain_path(),"",$data['medium_url']);
    //unlink(get_full_domain_path().$path);
    $path = str_replace(get_domain_path(), "", $data['thumb_url']);
    unlink(get_full_domain_path() . $path);
    $sql = "DELETE FROM `photo` WHERE id='" . $pid . "'";
    $link = mysql_query($sql, $cn) or die("Error : " . mysql_error());
    disconnect_db($cn);
}
Esempio n. 2
0
 function image_update($id, $date, $title, $description, $rotate)
 {
     $cn = connect_db();
     if ($title == "") {
         $title = "No Title";
     }
     if ($description == "") {
         $description = "No Description";
     }
     $sql = "SELECT * FROM `photo` WHERE id='" . $id . "'";
     $link = mysql_query($sql, $cn) or die("Error : " . mysql_error());
     $data = mysql_fetch_assoc($link);
     $path1 = get_full_domain_path() . str_replace(get_domain_path(), "", $data['original_url']);
     $path2 = get_full_domain_path() . str_replace(get_domain_path(), "", $data['medium_url']);
     $path3 = get_full_domain_path() . str_replace(get_domain_path(), "", $data['thumb_url']);
     if ($rotate == "CW") {
         rotateImage($path1, "CW");
         rotateImage($path2, "CW");
         rotateImage($path3, "CW");
     }
     if ($rotate == "CCW") {
         rotateImage($path1, "CCW");
         rotateImage($path2, "CCW");
         rotateImage($path3, "CCW");
     }
     $d1 = date("Y-m-d", strtotime($date));
     $d1 .= date(" H:i:s", time());
     $sql = "update `photo` set upload_time='" . $d1 . "', title='" . formattext(htmlspecialchars(magicquotes($title))) . "', description='" . formattext(magicquotes(htmlspecialchars($description))) . "' where id='" . $id . "'";
     $link = mysql_query($sql, $cn) or die("Error : " . mysql_error());
     disconnect_db($cn);
 }