If I add a new image using a URL instead of uploading a file, the following code fragment produces broken links:
// Get next and previous image
if (!empty($image_row[$next_image_id])) {
$next_image_name = stripslashes($image_row[$next_image_id]['image_name']);
$next_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$next_image_id);
$next_image_file = MEDIA_PATH."/".$cat_id."/".$image_row[$next_image_id]['image_media_file'];
$next_thumb_file = THUMB_PATH."/".$cat_id."/".$image_row[$next_image_id]['image_thumb_file'];
}
if (!empty($image_row[$prev_image_id])) {
$prev_image_name = stripslashes($image_row[$prev_image_id]['image_name']);
$prev_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$prev_image_id);
$prev_image_file = MEDIA_PATH."/".$cat_id."/".$image_row[$prev_image_id]['image_media_file'];
$prev_thumb_file = THUMB_PATH."/".$cat_id."/".$image_row[$prev_image_id]['image_thumb_file'];
}
So {next_image_url}
results in:
<a href="./details.php?image_id=8"><img src="./data/thumbnails/3/http://www.abc123.com/pics/190/tn190-14.jpg" border="1"></a><br />
My suggested solution:
Track whether or not the image is from a URL or an uploaded file in the 4images_images table. Construct the image and thumbnail paths if it was uploaded otherwise just use the URL.
BE SURE TO UPDATE THIS TABLE COLUMN IF THE IMAGE IS EDITED AND A URL IS USED TO REPLACE A PREVIOUSLY UPLOADED IMAGE. (And delete the local image file) SAME FOR THE REVERSE SITUATION.
I like this approach since it would also allow for relative URLs. I have found that 1.5 beta currently only supports absolute URLs.
This IS supported:http://www.abc123.com/pics/190/190-12.jpg
This IS NOT supported:/pics/190/190-12.jpg
----------------------------------------------------------------------------------------
Wenn ich ein neues Bild mit einem URL addiere, anstatt, eine Akte zu hochladen, produziert das folgende Codefragment defekte Verbindungen:
// Get next and previous image
if (!empty($image_row[$next_image_id])) {
$next_image_name = stripslashes($image_row[$next_image_id]['image_name']);
$next_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$next_image_id);
$next_image_file = MEDIA_PATH."/".$cat_id."/".$image_row[$next_image_id]['image_media_file'];
$next_thumb_file = THUMB_PATH."/".$cat_id."/".$image_row[$next_image_id]['image_thumb_file'];
}
if (!empty($image_row[$prev_image_id])) {
$prev_image_name = stripslashes($image_row[$prev_image_id]['image_name']);
$prev_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$prev_image_id);
$prev_image_file = MEDIA_PATH."/".$cat_id."/".$image_row[$prev_image_id]['image_media_file'];
$prev_thumb_file = THUMB_PATH."/".$cat_id."/".$image_row[$prev_image_id]['image_thumb_file'];
}
So {next_image_url}
resultate innen:
<a href="./details.php?image_id=8"><img src="./data/thumbnails/3/http://www.abc123.com/pics/190/tn190-14.jpg" border="1"></a><br />
Meine vorgeschlagene Lösung: Schiene, ob oder nicht das Bild von einem URL oder von einer Antriebskraft Akte in der îmages_images Tabelle ist. Konstruieren Sie die Bild- und thumbnailwege, wenn es Antriebskraft anders gerader Gebrauch das URL war.
SEIEN Sie SICHER, DIESE TABELLE SPALTE ZU AKTUALISIEREN, WENN Das BILD REDIGIERT WIRD UND Ein URL BENUTZT WIRD, UM Ein VORHER ANTRIEBSKRAFT BILD ZU ERSETZEN. (und löschen Sie die lokale Bildakte), SELBEN FÜR DIE RÜCKCSituation.
Ich mag diese Annäherung, da sie auch relatives URLs zulassen würde. Ich habe gefunden, daß 1,5 Beta z.Z. nur absolutes URLs stützt.
Dieses WIRD gestützt:
http://www.abc123.com/pics/190/190-12.jpg
Dieses WIRD NICHT gestützt:
/pics/190/190-12.jpg