Page 10 of 16

Posted: Sat 1. May 2004, 20:27
by Jérôme
With the help Sustia, I have found out that you need freetype support enabled in PHP - which is quite obvious, but which we haven't thought of. It is clear: without freetype support, you can't handle any fonts...

I will update my first post to point this out.

Posted: Tue 4. May 2004, 04:34
by Jérôme
Version 1.2 BETA is now released

Sorry that I haven't released a new version earlier. I have now implemented cacheing into the MOD. I would be glad if some people could go an test this MOD heavily to see if the method improves the MOD.

Here is how it works:

The MOD looks if there is already a cached image file available. If not, it generates the picture and creates a new cache file from it (its name is concluded by the parameters that are comitted). If there is a file (with the same name) it will read and put out the stored file of the server.

The cached files are all stored in the "content/images" folder.

Please consider - this is only a beta version. I don't know if it works and this will probably put many many files in your "content/images" folder.

I appreciate every hint of yours.

And now I will fall into my bed because I have to return back to work in three hours. (Yes, I am the master of moaning ;))

Posted: Tue 4. May 2004, 06:32
by jsw_nz
Sounds great.

Do you think this might be an adaquate workaround for the NS 4.75 bug. My initial thoughts would be:

Create the initial image in IE and from there on out, even for Netscape clients, the image exists on the server. Not sure how you implemented 1.2. Just a preliminary question.

And do get some rest.........

Cheers,
jsw

Posted: Tue 4. May 2004, 08:26
by Jérôme
I am sorry I fear that this will not solve the problem. The call of the script still is the same, so NS 4.x will have problems to code/transmit/whatever the URI. But you can still give it a try, I really hope I am wrong.

Posted: Tue 4. May 2004, 09:23
by frold
Jérôme wrote: The MOD looks if there is already a cached image file available. If not, it generates the picture and creates a new cache file from it (its name is concluded by the parameters that are comitted). If there is a file (with the same name) it will read and put out the stored file of the server.

The cached files are all stored in the "content/images" folder.
Can someone explain to me what the idea of cached images is..? I don´t understand.... What is it for? why is it great? and when is it powerfull to use?

Posted: Tue 4. May 2004, 09:45
by Paradroid
Hi frold,

the MOD renders the graphic each time your page is viewed. If you have heavy load on you site, it could be that your server goes down and is only rendering images instead of serving pages ...

To prevent this, each time the MOD is called via the GT tag, the rendered graphic is stored in the "cache" and the next time the page is loaded, the MOD looks into the cache, if the reqired graphic is already rendered. If so, it only loads the graphic instead of rendering it again. This is much quicker and produces less server load.

I hope I explained it correctly

cu

Achim

Posted: Tue 4. May 2004, 09:53
by Jérôme
Before V1.2 Beta it was handled this way:

For every GT-Replacement Tag found in your articles, the MOD generated a new image dynamically. That means: the server must take the font, must create an image, must calculate height and width of the image, place the text in the middle of the picture and so on. And this for every replacement tag and for every user surfing your page. So, think of a quite highly frequented page which 100 pageviews per minute and 20 GT-Replacement Tags in it. That means that the server has to generate 2000 images a minute. This is a very heavy load for a processor and it gets even worse when you are on a shared host with many other website owners.

The principe of the cacheing is: look if the image file is there - if not, generate it. Otherwise: pass through the present image. This still generates a bit traffic load but not as much as the other method.

Version 1.3 will be even more enhanced (that's an idea that came to me while writing this article), so that the script even does not need to be called, and that will enable your browser to cache the image wich will decrease the load even more!

Because: at the moment it is still the script fontizer.php which has to be called with all parameters. The next step will be to check if there is a cached file before the script is called. That means that your browser will most likely never see the script called, but only the cached files.

@jsw_nz: And this will finally solve the NS 4.75 Bug - unless it is not a NS 4.x user that calls your page for the first time.

Posted: Tue 4. May 2004, 11:06
by frold
Thanks to you 2 (Jérôme and Paradroid)...Now I understand...

Posted: Tue 4. May 2004, 13:22
by kaju74
Are you sure you've upated your package??? I've downloaded the last beta (with caching) but the files are the same as the old version.

BTW: I love this mod :D

Posted: Tue 4. May 2004, 17:59
by Jérôme
The files are the same, but the content should be different. The fontizer.php has changed. But I will make a test download again...

Edit: Yes, it is the correct package.

Posted: Tue 4. May 2004, 18:47
by kaju74
My failure :oops:

I've compared all files except the \fonts directory - sorry!

Posted: Tue 4. May 2004, 22:35
by Jérôme
Version 1.3 released

This is an important release and it is recommended for everybody to upgrade. Please follow the instructions in the upgrade script (it is not much to do).

For security reasons: overwrite the complete mod-folder with the files in the ZIP-package and then delete the files "fontizer.php" (and evtl. "font.php") from the folder "inc_module/mod_graphical_text/inc_fonts/").

Important notices
The replacement tags have slightly changed

- Backgroundcolor is not optional anymore, but mandatory, due to the fact that I changed the image output to JPEG which is more compatible to browsers. Anyway, the transparency was awful!

- You will have to create a folder "gt" in your "content/images" folder and chmod it to 777. This is the folder in which your cached images will be stored. If you want to clear the cache, delete the images within this folder.

- The file fontizer.php has been removed. This has several reasons:

1. The function is now safe against possible exploits or people who want to use your script to create dynamic pictures on their own webspace. It is not possible to call this function from the exterior.
2. The surfer will never see that there is a script in action. I have done it a way that the surfer will always see the cached images.
3. According to (2) no browser should have problems with this MOD anymore, because the browser simply does not know that there is a MOD.

Harrrr, I am myself excited about this improvements!!

Try it out and give me feedback if your server load has decreased. It should have done so massively!!

Have fun!

- Jérôme

Posted: Tue 4. May 2004, 22:41
by Jérôme
The reason why I moved from PNG to JPEG:

Although PNG is supported by MOST browsers, it is not supported by the browser that most people use.

Sad, but true :?

Posted: Wed 5. May 2004, 00:17
by snobba
Looks fantasic Jerome!!

But freetype still have to be present for GD, right? My hosting provider are a bit lazy so I do not know if I will have it or not... :cry:

Posted: Wed 5. May 2004, 00:51
by cyrano
salut Jérôme,

what have i made or didn't?

I got this after logon into backend:
Parse error: parse error, unexpected T_CASE in /www/htdocs/akadoku/phpwcms.php on line 72
Hmm, any hints?