Please note that the forum isn't realy used anymore.

If you have questions, want support or just simply want to talk to us you can find us on slack.

 

Image field widget?

Hello all

I'm looking for a more elegant solution for my issue.

Situation: I have a page and I want it to have a 'cover picture'. Right now I am abusing the community Slideshow module for this: I create a slideshow with only 1 item and then I add a widget to the page with that slideshow.

Ideal solution is that you have a widget where you can add an image to, this image gets scaled and cropped in the form you want.

Isn't there an existing solution for this? I've already looked into the Modulemaker module but it is not stable and fails on creating the image.

Looking forward to hear some suggestions, thanks.

Do you mean something like I did here ? That's a page header block in my template where I can add an editor with the subtitle, and also a widget that will insert the background image.

When you go (in the backend) to the Modules section > Backgrounds module, then you get a list of background images. You can upload new images and set the css properties (like: background-size: cover, and background-position: center bottom). It will automatically make a widget for each picture, so you can insert the widget in a block on a page.

If that's what you mean, I can send you the "Backgrounds module" that I made. Or maybe I'll put it on Github...

Hey Jesse, thanks for your reply.

I think it's definitely a good thing to put it on Github. The more working modules you can find online, the more working code you'll see and you can use them as a guide.

Your solution is kind of the same as the Slideshow module. You upload everything on a separate page (Modules section > Backgrounds module) and that will create widgets. My question is that, instead of uploading everything and getting 20 different widgets, isn't it a possibility to upload it directly to the widget? For example: when you choose "editor", you are able to write text when you click it the edit icon. So when you choose "header image", you should be able to upload an image.

I'm new to Fork CMS and I'm just wondering if this is possible. Thank you!

Hmm no not possible in Fork CMS, but that's maybe a good idea to implement in the future...

In Fork, you have to manage everything that is module related in the modules section. If you inserted a widget on a page, you can press the edit button and it will take you to the module's edit page of that image. But you can't add images etc. from a page. You have to go to the module section

Thanks Jesse, this answers my question :-). Still very much interested in your background image module though. That way I don't have to abuse the slideshow module ...

I'll clean some code and test it in a new Fork installation and then I'll push it to github :-) I'll let you know

You could also expand the pages module with an extra image field. You can then use this image in your template.

example

In the example above an image and description field are added in a new tab. These fields are of course optional. The big benefit is that this removes the need for an extra module.

Good to know, I saw a few site's that used a description + image and I guessed that the pages module was extended with an extra tab :p

Cool idea Koen, not sure how to implement this though :-).

Pages is a module too. So I think you can edit the backend pages module (add.php and edit.php) and add an image field an description textbox to the form, and save it to the db. Then edit the views and add an extra tab with that imagefield and description. That should do it :p

Any update on your "Backgrounds module" on Github, Jesse?

Comment

The forum is deprecated in favor of our Slack channel, which provides real-time support for your issues.

Join us on Slack here: https://fork-cms.herokuapp.com/