This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

benm
benm

I created a plugin using Builder and successfully can put images into a piece of content with a Mediafinder widget.

I can easily display it with relative path

<img src="{{ '/storage/app/media/' ~  record.featured_image }}">

or with absolute path

<img src="{{ '/storage/app/media/' |app ~  record.featured_image }}">

However, if I try to use the Mediathumb filter like so:

<img src="{{ '/storage/app/media/' ~  record.featured_image |mediathumb_resize() }}">

or

<img src="{{ '/storage/app/media/' |app ~  record.featured_image  |mediathumb_resize() }}">

In either case it writes an thumbnail image to disk correctly but the file path generated repeats the file root twice :

http://localhost:3000/storage/app/media/storage/app/media/_mediathumbs/my-image-name-8e0135785ffae7b36505b6e2d5794ab8.jpg

'storage/app/media' is repeated twice as you see, and I suspect it has something to do with the construction of my twig code.

Anyone know what I'm doing wrong?

benm
benm

Actually it's funny how writing a forum question can lead to its own solution. I guess I don't fully understand how mediathumb is generating the thumb but apparently what works for printing the full-sized image does not work for mediathumb. The following does work:

<img src="{{ record.featured_image  |mediathumb_resize() }}">

I will update though if I end up hitting another snag.

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.