Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

[Solved] FileUpload add image alt

422422 Developer 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"

There was an error rendering this rich post.

Comments

  • Options
    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.'">';

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    422422 Developer 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.

    There was an error rendering this rich post.

  • Options

    try this, I haven't tested.

    $Img .= Img($ThumbnailUrl, array('class' => 'ImageThumbnail','alt'=>'User Image'));

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    422422 Developer MVP

    Perfect thankyou ;)

    There was an error rendering this rich post.

  • Options
    422422 Developer MVP
    edited August 2012

    Result: ( markup now validates )

    There was an error rendering this rich post.

  • Options
    422422 Developer MVP

    How do I accept your answer @Peregrine I dont see anywhere to click to accept ?

    Or have the "powers that be" moved stuff around ?

    There was an error rendering this rich post.

  • Options

    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?

    There was an error rendering this rich post.

Sign In or Register to comment.