Error: Notice: gallery image missing for id:
Moderator: General Moderators
-
tokolosche
- Forum Newbie
- Posts: 8
- Joined: Fri Aug 19, 2005 5:06 am
Error: Notice: gallery image missing for id:
Hello there,
I am very new to php, and have been working on a friends website for them as they were unhappy with their web designer. I have added a new page in for him to display more information, and to do that I had to go through a number of different steps and had to add some information into the database back end. After hours of fiddling around I thought I had it all running perfectly, but now I find out he can no longer upoad images through his website. Previously he had done this through an image manager.
The error that comes up when trying to add the new images in is:
Notice: gallery image missing for id: 215 in /home/csa/public_html/manager/helper_manage_gallery.php on line 74
In the image manager page it shows the little cross error when an image isn't displaying properly, and when I right click to go to properties it has the following path: http://www.website.com/manager/?1124445431
Upon viewing a previous image that still works, the properties show as: http://www.website.com/user_files/.gall ... 1124446457
So for some reason the path is not linking correctly.
Does this make sense to anyone? Does it look like I have missed a step in adding the new page, or have I stuffed something up?
Any help or suggestions anyone could give would be very appreciated!
Thanks
Andrew
I am very new to php, and have been working on a friends website for them as they were unhappy with their web designer. I have added a new page in for him to display more information, and to do that I had to go through a number of different steps and had to add some information into the database back end. After hours of fiddling around I thought I had it all running perfectly, but now I find out he can no longer upoad images through his website. Previously he had done this through an image manager.
The error that comes up when trying to add the new images in is:
Notice: gallery image missing for id: 215 in /home/csa/public_html/manager/helper_manage_gallery.php on line 74
In the image manager page it shows the little cross error when an image isn't displaying properly, and when I right click to go to properties it has the following path: http://www.website.com/manager/?1124445431
Upon viewing a previous image that still works, the properties show as: http://www.website.com/user_files/.gall ... 1124446457
So for some reason the path is not linking correctly.
Does this make sense to anyone? Does it look like I have missed a step in adding the new page, or have I stuffed something up?
Any help or suggestions anyone could give would be very appreciated!
Thanks
Andrew
- raghavan20
- DevNet Resident
- Posts: 1451
- Joined: Sat Jun 11, 2005 6:57 am
- Location: London, UK
- Contact:
-
tokolosche
- Forum Newbie
- Posts: 8
- Joined: Fri Aug 19, 2005 5:06 am
hi. thx for replying so quickly. The line 74 it is referring to is:
trigger_error('gallery image missing for id: '. $gallery_image['id']);
Id 215 is actually just a new record in the database. When I add a new record that has the error, it will show up that record, and any that are still showing on the page that aren't linking correctly.
I am now thinking that when I was learning how it all worked that perhaps I might have deleted a record then that had an image link in it. Any ideas on how I would locate what that was?
trigger_error('gallery image missing for id: '. $gallery_image['id']);
Id 215 is actually just a new record in the database. When I add a new record that has the error, it will show up that record, and any that are still showing on the page that aren't linking correctly.
I am now thinking that when I was learning how it all worked that perhaps I might have deleted a record then that had an image link in it. Any ideas on how I would locate what that was?
- raghavan20
- DevNet Resident
- Posts: 1451
- Joined: Sat Jun 11, 2005 6:57 am
- Location: London, UK
- Contact:
i hope this gallery pk 'id' is autocomplete. are you sure, still there is an entry in the database for the id 215??
if so, can you see the file path provided; if yes, then try to locate the image file in the server.
its wld be better if you give the code above the trigger_error stmt and you database table structure or the snapshot of last few values in the db.
if so, can you see the file path provided; if yes, then try to locate the image file in the server.
its wld be better if you give the code above the trigger_error stmt and you database table structure or the snapshot of last few values in the db.
-
tokolosche
- Forum Newbie
- Posts: 8
- Joined: Fri Aug 19, 2005 5:06 am
yeah, record 215 is in there, and it is an auotcomplete field for the ID.
Sorry for sounding dumb, but what is a "trigger_error stmt"?
By the way, not sure if it would help, but the code that is around that error is:
feyd | Please use
Sorry for sounding dumb, but what is a "trigger_error stmt"?
By the way, not sure if it would help, but the code that is around that error is:
Code: Select all
/* check if has permissions to have a gallery */
if ($page['has_gallery'] != 'yes') {
trigger_error('insufficient permissions for gallery on page: '. $page['id'], E_USER_ERROR);
}
/* checked if the gallery is even enabled */
if ($page['gallery_enabled'] != 'yes') {
trigger_error('gallery was not enabled but tried to manage it on page: '. $page['id'], E_USER_ERROR);
}
/* collect all the gallery images and corresponding data */
$query = "
SELECT
id, caption
FROM
gallery_image
WHERE
page_id = '{$page['id']}'
ORDER BY
listing_order
";
$result = mysql_query($query) or trigger_error(mysql_error(), E_USER_ERROR);
$gallery_images = array();
while ($row = mysql_fetch_assoc($result))
{
$gallery_image = $row;
$gallery_image_url = sprintf("%s/%s.jpg", GALLERY_IMAGES_URL, $gallery_image['id']);
$gallery_image_path = sprintf("%s/%s.jpg", GALLERY_IMAGES_PATH, $gallery_image['id']);
if (file_exists($gallery_image_path)) {
$gallery_image['url'] = sprintf("%s/%s.jpg", GALLERY_IMAGES_URL, $gallery_image['id']);
} else {
trigger_error('gallery image missing for id: '. $gallery_image['id']);
}feyd | Please use
Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]-
tokolosche
- Forum Newbie
- Posts: 8
- Joined: Fri Aug 19, 2005 5:06 am
oh and the structure is:
Field Type Attributes Null Default Extra Action
id int(10) UNSIGNED No auto_increment
page_id varchar(255) No
caption varchar(255) No
have_popup enum('yes', 'no') No yes
details text No
link varchar(255) No
popup_size enum('small', 'medium', 'large') No small
listing_order int(10) UNSIGNED No 0
Field Type Attributes Null Default Extra Action
id int(10) UNSIGNED No auto_increment
page_id varchar(255) No
caption varchar(255) No
have_popup enum('yes', 'no') No yes
details text No
link varchar(255) No
popup_size enum('small', 'medium', 'large') No small
listing_order int(10) UNSIGNED No 0
-
tokolosche
- Forum Newbie
- Posts: 8
- Joined: Fri Aug 19, 2005 5:06 am
oops, i just realised what the trigger error statement is. 
I have just worked out that the problem is that the image manager automatically changes the names of the images when it is uploading them. Normally it would have added new images and titled them by the next image in the order. I.e. 1.jpg, 2.jpg, 3.jpg.
What it is now doing is changing the image name in the file path to the database ID number instead.
I hope that helps!?
I have just worked out that the problem is that the image manager automatically changes the names of the images when it is uploading them. Normally it would have added new images and titled them by the next image in the order. I.e. 1.jpg, 2.jpg, 3.jpg.
What it is now doing is changing the image name in the file path to the database ID number instead.
I hope that helps!?
- raghavan20
- DevNet Resident
- Posts: 1451
- Joined: Sat Jun 11, 2005 6:57 am
- Location: London, UK
- Contact:
you see this condition does not execute. a file is not found at "$gallery_image_path".if (file_exists($gallery_image_path)) {
$gallery_image['url'] = sprintf("%s/%s.jpg", GALLERY_IMAGES_URL, $gallery_image['id']);
} else {
trigger_error('gallery image missing for id: '. $gallery_image['id']);
}
try to echo $gallery_image_path and check whether there is a file in the path.
trigger_error is used to raise manual errors when you do not meed any expected condition.
I have not used them here in PHP but in Oracle procedures.
-
tokolosche
- Forum Newbie
- Posts: 8
- Joined: Fri Aug 19, 2005 5:06 am
Hi raghavan20,
I have checked the path, and when I manually upload the images to the server through ftp, the image gallery works fine. After a lot of checking, it is doing the correct thing by taking the database ID, and making the image name the same. However, it no longer seems to actually be saving the images that are being uploaded to the server through the image manager.
One thing I did notice is that it seemed to stop working around the time of reaching 100 for the ID. I know I am grasping at straws here, but the fact that it has gone from a 2 digit ID to a 3 digit ID wouldn't have caused any issues would it?
I have checked the path, and when I manually upload the images to the server through ftp, the image gallery works fine. After a lot of checking, it is doing the correct thing by taking the database ID, and making the image name the same. However, it no longer seems to actually be saving the images that are being uploaded to the server through the image manager.
One thing I did notice is that it seemed to stop working around the time of reaching 100 for the ID. I know I am grasping at straws here, but the fact that it has gone from a 2 digit ID to a 3 digit ID wouldn't have caused any issues would it?