codemonauts / craft-customizable-radio-buttons-field

Radio buttons field for Craft CMS, customizable with CSS classes, icons, images and text
MIT License
6 stars 5 forks source link

Images not being published #1

Closed spAnser closed 4 years ago

spAnser commented 5 years ago

The example: https://github.com/codemonauts/craft-customizable-radio-buttons-field/blob/master/examples/positions/buttons.php

The images don't show up because they are not being published because getPublishedUrl second argument is false:

https://github.com/codemonauts/craft-customizable-radio-buttons-field/blob/5a1f87c19c2874142ab4abc905ff602aacc06fe7/src/fields/Buttons.php#L89

kringkaste commented 5 years ago

Hi! I tested it right now and it's working as expected. The images will be published on request. Did you copy the images in the same subdirectory structure as required in the config file? They have to be in @config/buttons/images.

spAnser commented 5 years ago

Yes and I couldn't get them to show up. By changing the false to true everything started working for me.

According to the craft documentation if you have the second argument as false it wont publish files. https://docs.craftcms.com/api/v3/craft-web-assetmanager.html#public-methods

If you already have the files in cpresources then it will work fine. But with new images that don't exist in cpresources it wont copy them over.

kringkaste commented 5 years ago

Hmm, I verified this. Yes, you are right, with "true" as second parameter, the files will be written down to the disc in the directory cpresources. In our installation, the request is passed to index.php, when the files are not found. So craft is sending the images (fall back way). And that's based on the hash used in the path and the corresponding entry in the db table "resourcepaths". So yes, we will change this to true, but it should work also in the other way.

kringkaste commented 5 years ago

I just released 1.0.1 fixing this. Please test it.