url image module media file



  • hi
    i upgrade platform and url media change from /assets/media/correct_smallThumb.png to

    /storage//assets/media/correct_smallThumb.png Is there any path configuration?


  • admin

    Hi,

    Asgard is now using the Laravel Storage:: facade to resolve URLs.
    This needs your app_url to be set.
    Also make sure your configuration files are up to date.



  • It helped to update the filesystem configuration file. The url parameter for driver local was missing. thanks



  • thank you !


  • admin

    Awesome good to know. I'm going to add that to the upgrade guides of the docs.



  • next problem "Trying to get property of non-object"

    code in blade: {{ Imagy::getThumbnail($offer->files()->where('zone', 'icon')->first()->path, 'mediumThumb') }}

    in controller:
    code: $offer->files()->where('zone', 'icon')->first()->path
    return
    MediaPath {#942 ▼
    -path: "/assets/media/93463806.jpg"
    }


  • admin

    Hm make sure you have the same offer in the view.

    Also, there's a helper method filesByZone('icon') that you could use.



  • The problem occurs in an array of objects
    one object
    $offer = $this->offer->findBySlug($slug); - work

    controller $offers = $this->offer->allTranslatedIn(App::getLocale());

    view <?php foreach ($offers as $item): ?>
    <img src="{{ Imagy::getThumbnail($item->filesByZone('icon')->first(), 'mediumThumb') }}" alt="{{ $item->title }}" />

    not work



  • Not only photo, other values like title will load

    @sgweb said in url image module media file:

    The problem occurs in an array of objects
    one object
    $offer = $this->offer->findBySlug($slug); - work

    controller $offers = $this->offer->allTranslatedIn(App::getLocale());

    view <?php foreach ($offers as $item): ?>
    <img src="{{ Imagy::getThumbnail($item->filesByZone('icon')->first(), 'mediumThumb') }}" alt="{{ $item->title }}" />

    not work


  • admin

    Make sure you're on the right objects. It can be the only issue as the methods exist. Try debugging it.



  • i have no idea
    one object work
    $mod = new Offer();
    $offers = $mod->first();
    $offers->filesByZone('icon')->first();
    array object no return file
    $mod = new Offer();
    $offers = $mod->all();
    $offers[0]->filesByZone('icon')->first();


  • admin

    That's normal, not all objects will have the relation, just like any relation inside laravel. Check the laravel documentation on relationships in eloquent for more information about this.



  • solution in blade in loop
    Imagy::getThumbnail( (string)$offer_item->filesByZone('icon')->first()['path_string']

    thx


  • admin

    That doesn't really look right.

    I've updated the related documentation page with more information about this subject: https://asgardcms.com/docs/v2/media-module/getting-files-and-thumbnails

    (Note that the blade directive option hasn't been tagged yet)


Log in to reply
 

Looks like your connection to AsgardCms was lost, please wait while we try to reconnect.