Jeg har et problem med et gallery jeg er igang med, kan ikke lige gennemskue hvorfor jeg får 404 når jeg forsøger at indlæse de fotos jeg har uploaded.
step 1:
upload af billeder og vis dem efter uploadet, virker fint
- ….
- 'onComplete' : function(event, ID, fileObj, response, data) {
- response = eval('(' + response + ')');
- console.log(response);
-
- if(response.uploaded){
-
- $("#pics").append("<img src='/lib/modules/image_resizer/image.php?height=100&width=100&image="+ response.file +"' />");
- $("#pics").append("<input type='hidden' name='pics[]' value='"+ response.file +"' /><br/>");
-
- }
- ….
HTTP/1.1 200 OK
Date: Fri, 20 Jan 2012 10:44:48 GMT
Server: Apache
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Last-Modified: Fri, 20 Jan 2012 10:44:48 GMT
Content-Length: 9569
Content-Type: image/jpeg
step 2:
indsæt i databasen, virker fint.
- if(isset($_POST["doSubmit"])){
- if(count($_POST["pics"]) >0 && strlen($_POST["title"]) >0){
-
- $title = $lib->db->makesafe($_POST["title"]);
- $user_id = $lib->user->get("user_id");
-
- $lib->db->query("INSERT INTO ".dbPrefix."gallery (title, user_id) VALUES ('$title', $user_id)");
- $album_id = $lib->db->last_inserted_id();
- $sql = "INSERT INTO ".dbPrefix."gallery_pictures (gallery_id, picture) VALUES ";
- foreach($_POST["pics"] as $pic){
- $picture = $lib->db->makesafe($pic);
- $sql .= "($album_id, '$picture'),";
- }
- if($lib->db->query(substr($sql,0,-1))){
- $noti->addNotification(translate("Saved"), notifications_types::_success);
- //TODO: add header back to gal-list
- }else{
- $noti->addNotification(translate("Failed"), notifications_types::_error);
- }
- }else{
- $noti->addNotification(translate("Missing: title or pictures"), notifications_types::_error);
- }
- }
gallery:
========================
# id # title # user_id
--------------------------------
5 # test 2 # 1
========================
gallery_pictures:
=======================================================
# id # gallery_id # picture
---------------------------------------------------------------------------
21 5 /files/gallery/6f370da47c1dfd7525f57263fe3566
=======================================================
step 3:
vis album, får 404 på billederne (som blev vist på upload siden.)
- $id = $lib->db->makesafe($_GET["gid"]);
- $album_data = $lib->db->query("SELECT title FROM ".dbPrefix."gallery WHERE id=$id && user_id=".$lib->user->get("user_id"));
- if(count($album_data)==0){
- header("location: /album/list");
- exit;
- }
-
- $images_html = "";
- $album_pictures = $lib->db->query("SELECT picture FROM ".dbPrefix."gallery_pictures WHERE gallery_id=$id");
- if(count($album_pictures)>0){
- foreach($album_pictures as $pic){
- //$url = "/lib/modules/image_resizer/image.php?height=100&width=100&image=".$pic["picture"];
- $url = $pic["picture"];
- $images_html .= "<img src='$url' alt='failed to load img' />";
- $images_html .= "<input type='hidden' name='pics[]' value='".$pic["picture"]."' /><br/>";
- }
- }
"NetworkError: 404 Not Found - http://---/files/gallery/6f370da47c1dfd7525f57263fe3566"
"NetworkError: 404 Not Found - http://---/lib/modules/image_resizer/image.php?height=100&width=100&image=/files/gallery/6f370da47c1dfd7525f57263fe3566"
Jeg er helt blank for idéer, filen kan ses på den ene side men ik den anden :/
filen bliver ikke slettet nogen steder, kan se den via FTP.