WebsiteBaker Community Forum

WebsiteBaker Support (2.13.x) => Modules => Topic started by: applepie on June 26, 2023, 10:35:42 PM

Title: Mini Hero Banner
Post by: applepie on June 26, 2023, 10:35:42 PM
Hi,
Can someone tell me why my Mini Hero Banner suddenly stopped reading images from the WebsiteBaker Media Folder? It was working fine when I first installed it. I was able to read images I uploaded in the Media Folder. Now, whenever I want to add an image to the Mini Hero Banner it takes me straight to my hardrive. It wouldn't show or link to the WebsiteBaker Media Folder?
Thanks
Title: Re: Mini Hero Banner
Post by: sternchen8875 on June 26, 2023, 11:43:52 PM
do you talk about the upload-function in the backend, where you start to select a picture as the new banner?

or do you talk about the tab "current image", that show the actual banner (for this section)?

to the first option: this module from Ruud use in all previous versions the simple html-input-type=file-method to select a file somewhere from the harddisk of this used machine. this funktion remember the last used folder from this adress, but it stay on the harddisk of the used PC / machine.
that means, if you select in the first use a locale folder and this is the folder /media/miniHero as locale copy from this website-Baker Installation, your description works and you can open this folder directly in a second time (if you dont use this select-button not on another place, maybe, to install a new addon.
but it means also, it is not possible, to jump with this Upload-Button online into the media-Folder of this installation, also online.
it is possible, to give this upload-button a special start-folder via javascript and more stuff, but it makes no sense, if you work with multiple users - i'm sure, that the miniHero-Addon never use a official funtion like that.

the second option... display the current image or banner

the pictures are stored in the folder media/minihero. if you upload the banner, the save-process rename this picture to the name "image-" and add the section-id at the end, for example: image-35.jpg. Allowed are jpg and png
the usage of the actual section-id allowed the usage of multiple picture from multiple sections in the same folder.

it is also possible, to upload a new banner-picture with the media-administration of WB, when you rename the uploaded picture to the descriped scheme. So, if you dont see your actual banner for this section, take a look to the actual section-id (see top of this module), go to the media administration and search the folder media/minihero, to see the stored pictures there. Do you see the actual banner-picture the with the name "image-"+Section-ID?

Maybe, there is a broken image or a wrong filetype. a simple test is a new upload
Title: Re: Mini Hero Banner
Post by: applepie on June 27, 2023, 01:36:56 AM
Yes, I am talking about the upload-function in the backend, where I can select a picture for the banner. When I slect Upload Image it takes me to my hard drive instead to the Media Folder. Can you explain again please? Do you mean it is not possible to upload photo from the Image Folder in
Title: Re: Mini Hero Banner
Post by: sternchen8875 on June 27, 2023, 12:48:36 PM
Can you explain again please?

the upload button is a html-function, it works with the (HTML-) Code input type="file". if you click on this button, it starts a dialog with the locale machine, doesn't matter, what kind of systems, works also in windows, android, mac etc. the same for the print-button, email-link etc, they all using intern functions from this locale machine.

the locale machine has a (big) intern cache and part of this cache is the last used adress for this file-select. if you build a simple html-form with a button like this, you see, that the select everytime start on this place, where you select a file the last time and send this form after the select. if you use now your browser online on the webadress http://abc.com and you start's the file-select-dialog, the browser / locale machine search in the cache for the last place on your harddisk. if he found a adress from  http://abc.com, it use this folder as start-point, if not, it starts on the Workplace, for example in the windows-explorer or in the file-manager.

with javascript and visual basic, it is possible, to overwrite the adress from the cache and set a fix startpoint, somewhere on you locale machine, but it make's only sense, if you're a single user and you work the whole time on this machine. For example: i'm using ~ 20 partitions on my pc, called from A: to Q: and backwards from Z: to R: as locale network-paths.
so i can set a start-point for the file-select on my machine only to harddisk Q:, but maybe nobody has also a partition Q:. Result is: only users with a harddisk Q: can use my path, the rest get an error. For me, it works only, if i stay at home on my pc, where i've the partion Q:, but not on a other machine like tablet, phone etc
Because of that, i'm very sure, that this addon newer use a script like this, to change the start point for the file select. Ruud has the possibility, to download also the older versions of this module and there is no code for that - thats why, i've to say: you're wrong or it was coincidence, that your file-select start's in the locale folder inside of the media from a locale backup.


but i cannot say, it is not possible, to have a file browser with this function
two more options with a lot of work...

if you take a look into the ckeditor, you have there a connector with a file browser. so you see, it's possible, to have a file browser for the media-administration. but its a very big construct (half size from the ckeditor) and many things to do, to add this connector to a small module like minihero. the addon has a size from ~ 21kb. with a connector like the ckeditor, it needs maybe 2 or 3 megabytes

the other way is a globale upload function inside of WB. i remember, that we talk about this a couple of years ago. this solution replace the WB-Media-Management and use a seperat addon like elfinder. Every up- or download, every file select goes over this new addon. But in this case, you've to change every other addon also, to add a interface to the media module. its is possible in the basis package of a cms like WB, but not in all addons. too much work, to change everything.

Quote
Do you mean it is not possible to upload photo from the Image Folder in

it is possible, if you have a locale copy on your machine and you select the file from there.
it is not possible, if you want to select a file online from a server adress, for example: from the online-media-folder
Title: Re: Mini Hero Banner
Post by: applepie on July 02, 2023, 11:57:29 PM
Thanks for the taking the time to explain. So, in another word there is no straight forward solution. And, it is possible but have to do alot of work on it.
Thanks
Title: Re: Mini Hero Banner
Post by: applepie on July 27, 2023, 12:10:57 PM
One last question. Mini Hero doesn't render properly on some browsers. I am using Firefox on Apple and it looks fine. But. on some pc, the image is partially shown and gray on the rest of the background. Does anyone else experience the same problem and able to shed some lights please? Thanks
Title: Re: Mini Hero Banner
Post by: sternchen8875 on July 27, 2023, 03:21:01 PM
One last question. Mini Hero doesn't render properly on some browsers. I am using Firefox on Apple and it looks fine. But. on some pc, the image is partially shown and gray on the rest of the background. Does anyone else experience the same problem and able to shed some lights please? Thanks

this it to 100% a browser-specific problem and need some css-definitions for this browsers extra. maybe, you found some solutions in the web, but dont forget: not every css-function has the support from all browsers.
Here a little help, in the example for the css-function: background-size: cover (maybe, it is, what you need for the image-resize there) -> https://caniuse.com/?search=background-size%3A%20cover

Use also BrowserTools (F12 in nearly every modern browser), to found the problem