If an image is uploaded that happens to have the same filename as a previously uploaded file, the slideshow module fails to create a resized image for display. The problem happens because the upload module automatically generates a new file name by appending something like _0 or _1 to the original file name.
Reading through the upload module's code, I found these comments, which helped me craft a fix:
// URLs to files being previewed are actually Drupal paths. When Clean
// URLs are disabled, the two do not match. We perform an automatic
// replacement from temporary to permanent URLs. That way, the author
// can use the final URL in the body before having actually saved (to
// place inline images for example).
foreach ($previews as $file) {
$old = file_create_filename($file->filename, file_create_path());
$new = url($old);
To correct the problem in slideshow.module, I changed the following line of code in function slideshow_submit() near line 200:
ORIGINAL:
$filename = slideshow_build_image_path($file['filename']);
MODIFIED:
$filename = slideshow_build_image_path(file_create_filename($file['filename'], file_create_path()));
Sorry for not including a proper patch file. I haven't learned how to make them yet.
JM
Comments
Comment #1
drupalworld CreditAttribution: drupalworld commentedAnybody could come up with a similar patch for drupal 5??
Many thanks,
Drupalworld
Comment #2
kkaefer CreditAttribution: kkaefer commentedFixed in 2.x for D5