[Solved] FileUpload add image alt
422
MVP
Noticed fileupload doesnt include alt text for image.
So With the code below: What do I need to add to include alt text for images ?
<?php
$Path = GetValue('Path', $Media);
$Img = '';
if ($CanDownload) {
$DownloadUrl = Url(MediaModel::Url($Media));
$Img = '<a class="lightbox1" title="User Image" href="'.$DownloadUrl.'">';
}
$ThumbnailUrl = MediaModel::ThumbnailUrl($Media);
$Img .= Img($ThumbnailUrl, array('class' => 'ImageThumbnail'));
if ($CanDownload)
$Img .= '';
echo $Img;
?>
I just want ONE size fits all alt , example: alt="User Image"
Comments
Are you changing it in the php code or via jquery
so this doesn't work or have I misread what you want.
$Img = '<a class="lightbox1" title="User Image" alt="User Image" href="'.$DownloadUrl.'">';
In the php above preferably. I just need to add this exactly. alt="User Image" somewhere to the above code chunk.
Needs to defined in the array.
try this, I haven't tested.
$Img .= Img($ThumbnailUrl, array('class' => 'ImageThumbnail','alt'=>'User Image'));
Perfect thankyou
Result: ( markup now validates )
How do I accept your answer @Peregrine I dont see anywhere to click to accept ?
Or have the "powers that be" moved stuff around ?
No, it depends on the category whether you see that 'accept' functionality. Don't know why.
I'll mark it as solved?