Different file formats in URL::asset(...)

Posted 4 months ago by Ivans84

Hello everybody.

I have a web page with some pictures. Most of them are in .jpg format, but I also have some in .png format. I need to make a universal link which could let me display both format pictures. At the moment my code looks like this:

    <a href="{{ URL::asset('images/pages/albums/'.$albumName.'/'.$picture->pictureName.'.jpg') }}">
        <img src="{{ URL::asset('images/pages/albums/'.$albumName.'/small/'.$picture->pictureName.'.jpg' }}">

If you can help me please, how I need to change the line started with "<a href..." and "<img...", so two formats could be displayed?

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.