Graphical Text MOD - FINAL - Version 2.0

Post custom hacks and enhancements for phpwcms here only. Maybe some of these things will be included in official release later.
Locked
Jérôme
Posts: 481
Joined: Tue 16. Mar 2004, 10:33
Location: Cologne, Germany
Contact:

Post 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.
Jérôme
Posts: 481
Joined: Tue 16. Mar 2004, 10:33
Location: Cologne, Germany
Contact:

Post 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 ;))
User avatar
jsw_nz
Posts: 907
Joined: Fri 2. Apr 2004, 02:42
Location: New Zealand

Post 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
Jérôme
Posts: 481
Joined: Tue 16. Mar 2004, 10:33
Location: Cologne, Germany
Contact:

Post 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.
frold
Posts: 2151
Joined: Tue 25. Nov 2003, 22:42

Post 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?
http://www.studmed.dk Portal for doctors and medical students in Denmark
User avatar
Paradroid
Posts: 176
Joined: Fri 19. Mar 2004, 13:14
Location: Wuppertal
Contact:

Post 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
ParaDroid

knquadrat edv + marketing
http://www.knquadrat.de

phpWCMS Dokumentation | Deutsch | English
Jérôme
Posts: 481
Joined: Tue 16. Mar 2004, 10:33
Location: Cologne, Germany
Contact:

Post 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.
frold
Posts: 2151
Joined: Tue 25. Nov 2003, 22:42

Post by frold »

Thanks to you 2 (Jérôme and Paradroid)...Now I understand...
http://www.studmed.dk Portal for doctors and medical students in Denmark
kaju74
Posts: 68
Joined: Fri 5. Mar 2004, 11:24

Post 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
Jérôme
Posts: 481
Joined: Tue 16. Mar 2004, 10:33
Location: Cologne, Germany
Contact:

Post 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.
kaju74
Posts: 68
Joined: Fri 5. Mar 2004, 11:24

Post by kaju74 »

My failure :oops:

I've compared all files except the \fonts directory - sorry!
Jérôme
Posts: 481
Joined: Tue 16. Mar 2004, 10:33
Location: Cologne, Germany
Contact:

Post 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
Jérôme
Posts: 481
Joined: Tue 16. Mar 2004, 10:33
Location: Cologne, Germany
Contact:

Post 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 :?
snobba
Posts: 166
Joined: Sat 6. Mar 2004, 12:41
Location: Sweden
Contact:

Post 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:
cyrano
Posts: 1598
Joined: Sat 31. Jan 2004, 18:33
Location: Stuttgart
Contact:

Post 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?
Gruß/ regards cyrano
--------------------------------------------------------
templates -> http://www.128.weitzelmedia.de
planepix -> http://www.planepix.de
XING -> https://www.xing.com/profile/Thomas_Weitzel3
Locked