[Solved] FileUpload add image alt

422422 MVP
edited August 2012 in Vanilla 2.0 - 2.8

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

  • peregrineperegrine MVP
    edited August 2012

    Are you changing it in the php code or via jquery

    $Img = '<a class="lightbox1" title="User Image" href="'.$DownloadUrl.'">';

    so this doesn't work or have I misread what you want.

    $Img = '<a class="lightbox1" title="User Image" alt="User Image" href="'.$DownloadUrl.'">';

  • 422422 MVP
    edited August 2012

    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 ;)

  • 422422 MVP
    edited August 2012

    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 ?

  • 422 said:
    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?

Sign In or Register to comment.