templaza / astroid-framework

Powerful framework for designers and developers to create responsive, fast & robust Joomla based websites and templates.
https://astroidframe.work/
GNU General Public License v3.0
86 stars 15 forks source link

Temporary font files floot the server memory #539

Open StephanL72 opened 10 months ago

StephanL72 commented 10 months ago

Hello,

I've included my fonts locally in Astroid 3.0.8 in order to achieve the requirements of the GDPR (not to iclude from Google...). My hoster informed me that my server space is running low because of storing GB of files. Im am wondering because I haven't changed anything in my web project in the last days...but more and more files were stored on the server. After analysing the files we noticed that a /tmp folder above the joomla installation is beeing filled with fonts tmp files: Screenshot 2024-01-19 161221

How can I change that and is there a solution to avoid these tmp font files??

BTW: Same issue (no solution): https://www.joomlaplates.de/forum/joomla-4-templates/621-fonts-lokal-eingebunden-tmp-dateien.html

Thanks a lot for an idea!!!

Chacapamac commented 10 months ago

@StephanL72 Not Sure if it help, this is Bing Chat GPT answer.

======================================= It seems that you are using a custom font on your Joomla site, and the font files are accumulating in the tmp folder. This can cause disk space issues and security risks, so it is advisable to clean the tmp folder regularly.

There are a few possible reasons why the font files are not being deleted automatically from the tmp folder:

1. The font files are not being properly referenced in your CSS file. You need to make sure that the font-face declaration has the correct path to the font files, and that the font-family name matches the one used in your HTML or template settings12.

2. The font files are not web-friendly and need to be converted to WOFF or WOFF2 format. You can use an online converter like Transfonter to generate the web fonts and replace the original ones12.

3. The tmp folder does not have the right permissions to allow Joomla to delete the font files. You need to check the folder permissions and make sure that they are set to 755 or 777, depending on your server configuration34.

• To prevent the font files from piling up in the future, you can also use these Joomla extensions to clean or schedule a regular cleanup of the tmp folder. — [Admin Tools Pro] — [Cache Cleaner]

These extensions can also help you optimize your site performance and security

=======================================

I hope this helps!

deltapapa01 commented 10 months ago

Hi @StephanL72 , this is a Server/PHP config prob, some user have the same on other templates or CMS. You can read here: https://github.com/templaza/astroid-framework/issues/239#issuecomment-1304024075

Solution: Delete the woff files, that's it. That works for me, sometimes woff2 can make these temp files too, but woff2 works for me fine. Pro tipp: Delete these temp files with ssh, thats much faster than with ftp :-)

Chacapamac commented 10 months ago

Working with Woff and Woff2 without problems on MAMP and my live server. — No “fnt” files — Call by template custom scsss file e.g.

@font-face { font-family: "Source Sans Pro"; font-style: normal; font-weight: 400; src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url('../fonts/sourcesanspro/source-sans-pro-v13-latin-regular.woff2') format('woff2'), / Chrome 26+, Opera 23+, Firefox 39+ / url('../fonts/sourcesanspro/source-sans-pro-v13-latin-regular.woff') format('woff'); / Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ / }

tmumm commented 6 months ago

Anyone have any idea what is the ideal format to use? Seeing conflicting information on these two threads - woff, woff2 or ttf? I've had over 40gb in tmp folder in a week, its not sustainable to keep emptying the tmp folder.

sonvnn commented 6 months ago

@tmumm Solution is use ttf instead of woff.

Chacapamac commented 6 months ago

On modern website efficiency and speed is one of the most important factor for success and good ranking.

The most efficient font format for modern websites is WOFF2. It enjoys wide browser support and offers the best compression—up to 30% better than WOFF, leading to quicker download times. The WOFF2 format is often the only one needed for full compatibility across modern browsers — https://web.dev/learn/performance/optimize-web-fonts. It’s a great choice for ensuring your website loads quickly and efficiently, without sacrificing quality or compatibility.

For modern websites, it’s important to use web-safe fonts that are compatible across different browsers and devices. The commonly used font formats for web design include:

Chacapamac commented 6 months ago

I’m using a combination of “Woff” and “Woff2” fonts on this website —> https://grafcomm.ca/ and https://efoilsurf.ca. and NO “fnt” fonts files are or accumulate in the SERVER “tmp” directory.

The difference, in these two cases are maybe that I bypass Astroid Custom fonts system and passing by a font call in my custom.scss to call the fonts? (see above...)

tmumm commented 6 months ago

OK, to verify - I switched to loading via @font-face on the custom.css file and the issue went away, using woff2 files. So there appears to be a real issue with Astroid and local font loader. If it requires TTF it should be made clear, but to clarify, I didn't test if using TTF did not result in this problem. Thanks for the feedback.

Chacapamac commented 6 months ago

@sonvnn Astroid should be able to use the more efficient and modern fonts formats.

teflonmann commented 3 months ago

I confim it's a local fonts issue. To me it looks like on each and every page load the astroid plugin determines whether the font configuration remains unchanged. It unpacks the woff files to find out the precise name of the font to put it into the CSS code. The unpacking creates the file in the .tmp folder and it remains as long as the hoster wants it to live. In my opinion this should only happen once: when you save the template configuration and not each time you render a page. Store the font information somewhere in the database and create the CSS code based on this data.