Hello,

I wanted to streamline the image upload for my users (more user friendly).
I am using imagefield 5.x-1.2-rc1 on a test site.

1. I want alt text and Title fields. I don't want users to have to do it manually, it confuses some of them.

2. The widget states: 'Enable custom alternate text for images. Filename will be used if not checked.' The same is said for custom title text.

3. It would be great if the title field (mandatory under the manage field tab) could be what is used instead of the Filename.

QUESTION: Can I change the php so that the title field is what automatically populates instead of $filename?.

I appreciate it

Thanks,
Lorraine

Comments

Vibration’s picture

Title: Use title field to populate alt text and custom title text fields instead of filename. » Use title field instead of filename for alt text
jpetso’s picture

Version: 5.x-1.2-rc1 » 5.x-2.0-rc6
Category: support » feature

Yes, you can do that, by copying the theme_imagefield_image() function to your theme's template.php as phptemplate_imagefield_image(), and changing the two lines from that (newly copied) function:

$alt = empty($alt) ? $file['alt'] : $alt;
$title = empty($title) ? $file['title'] : $title;

into:

$title = empty($title) ? $file['title'] : $title;
$alt = empty($alt) ? (empty($file['alt']) ? $title : $file['alt']) : $alt;

Untested, but that should work. Nevertheless, having this by default would be nice, and would probably happen at field storage time already. Changing the issue to "feature request".

quicksketch’s picture

Category: feature » support
Status: Active » Closed (fixed)

Closing since the request is answered. The description is now the default link title in the 6.x version.