Download & Extend

Add ALT property on node edit form image preview

Project:ImageField
Version:6.x-3.2
Component:Code
Category:bug report
Priority:minor
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

<?php
function theme_imagefield_admin_thumbnail($item = NULL) {
   ...
  return
'<img src="'. file_create_url($thumb_path) .'" title="' . check_plain($item['filename']) . '" />';
}
?>

There's no alt text, making it fail validation.

There's also a warning

   1.   Warning  Line 274, Column 14: reference to non-existent ID "edit-field-icon-0"

       <label for="edit-field-icon-0" >Icon </label>

cause the id is actually edit-field-icon-0-upload or something. Not sure how to address that.

Patch adds in alt text for that theme function

AttachmentSize
imagefield_alt_text.patch614 bytes

Comments

#1

Just a note, alt text should never be the name of a file. If it's decorative then the alt text should just be empty. It's not decorative in this case, something like "Image preview" would be more suitable for a case like this.

#2

Oh :O!

Here's the patch with file name replaced (in a texteditor, so if I managed to get some syntax wrong.. I'll be amused and regretful) with t("Image preview") for the alt text.

AttachmentSize
imagefield_alt_text.patch 601 bytes

#3

Title:Markup validation on node edit forum» Add ALT property on node edit form image preview
Status:active» fixed

Thanks finally committed in preparation for the 3.3 version.

#4

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.