Copy Source | Copy HTML Options -Indexes Options +FollowSymLinks DirectoryIndex index.php <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !=/favicon.ico RewriteRule ^( .* )$ index.php? q =$ 1 [L,QSA] </IfModule>
Copy Source | Copy HTML Options -Indexes Options +FollowSymLinks DirectoryIndex index.php <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !=/favicon.ico RewriteRule ^( .* )$ index.php? q =$ 1 [L,QSA] </IfModule>
Copy Source | Copy HTML Options -Indexes Options +FollowSymLinks DirectoryIndex index.php <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !=/favicon.ico RewriteRule ^( .* )$ index.php? q =$ 1 [L,QSA] </IfModule>
Copy Source | Copy HTML Options -Indexes Options +FollowSymLinks DirectoryIndex index.php <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !=/favicon.ico RewriteRule ^( .* )$ index.php? q =$ 1 [L,QSA] </IfModule>
Copy Source | Copy HTML Options -Indexes Options +FollowSymLinks DirectoryIndex index.php <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !=/favicon.ico RewriteRule ^( .* )$ index.php? q =$ 1 [L,QSA] </IfModule>
Copy Source | Copy HTML Options -Indexes Options +FollowSymLinks DirectoryIndex index.php <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !=/favicon.ico RewriteRule ^( .* )$ index.php? q =$ 1 [L,QSA] </IfModule>
Copy Source | Copy HTML Options -Indexes Options +FollowSymLinks DirectoryIndex index.php <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !=/favicon.ico RewriteRule ^( .* )$ index.php? q =$ 1 [L,QSA] </IfModule>
Copy Source | Copy HTML Options -Indexes Options +FollowSymLinks DirectoryIndex index.php <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !=/favicon.ico RewriteRule ^( .* )$ index.php? q =$ 1 [L,QSA] </IfModule>
Copy Source | Copy HTML Options -Indexes Options +FollowSymLinks DirectoryIndex index.php <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !=/favicon.ico RewriteRule ^( .* )$ index.php? q =$ 1 [L,QSA] </IfModule>
Copy Source | Copy HTML Options -Indexes Options +FollowSymLinks DirectoryIndex index.php <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !=/favicon.ico RewriteRule ^( .* )$ index.php? q =$ 1 [L,QSA] </IfModule>
Copy Source | Copy HTML Options -Indexes Options +FollowSymLinks DirectoryIndex index.php <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !=/favicon.ico RewriteRule ^( .* )$ index.php? q =$ 1 [L,QSA] </IfModule>
Copy Source | Copy HTML
- // Check the parameters
- if ( empty ( $ _GET )) {
- get_page ();
- }
- elseif ( $ _GET [ 'q' ]) {
- $ nocache = isset ( $ _GET [ 'nocache' ])? TRUE: FALSE;
- $ arg = explode ( '/' , $ _GET [ 'q' ]);
- // Image Size
- $ size = get_size ( $ arg [ 0 ]);
- // Colour
- $ color = get_color ( $ arg [ 1 ], 'CCCCCC' );
- // Text
- $ text = isset ( $ arg [ 2 ])? $ arg [ 2 ]: $ size -> width. 'x' . $ size -> height;
- // Text color
- $ textcolor = get_color ( $ arg [ 3 ], '666666' );
- $ filename = get_image_path ( $ size , $ color , $ text , $ textcolor , $ nocache );
- if ( $ nocache ) {
- get_page ( array ( 'image' => $ filename ));
- }
- header ( "Content-Type:" . mime_content_type ( $ filename ));
- print file_get_contents ( $ filename );
- }
Copy Source | Copy HTML
- function get_size ( $ size , $ default = '200x200' ) {
- $ clear = isset ( $ size ) && preg_match ( "/ ^ [1-9] [0-9] + x [1-9] [0-9] + $ /" , $ size )? $ size : $ default ;
- $ size = explode ( 'x' , $ clear );
- $ return = new stdClass ();
- $ return -> width = $ size [ 0 ] < 5000 ? $ size [ 0 ]: 5000 ;
- $ return -> height = $ size [ 1 ] < 5000 ? $ size [ 1 ]: 5000 ;
- return $ return ;
- }
Copy Source | Copy HTML
- function get_color ( $ color , $ default = 'CCCCCC' ) {
- $ return = new stdClass ();
- $ rgb = isset ( $ color ) && preg_match ( "/ ^ [0-9a-fA-F] {6} $ /" , $ color )? strtoupper ( $ color ): strtoupper ( $ default );
- $ return -> red = hexdec ( $ rgb [ 0 ]. $ rgb [ 1 ]);
- $ return -> green = hexdec ( $ rgb [ 2 ]. $ rgb [ 3 ]);
- $ return -> blue = hexdec ( $ rgb [ 4 ]. $ rgb [ 5 ]);
- $ return -> color = $ rgb ;
- return $ return ;
- }
Copy Source | Copy HTML
- function get_page ( $ variables = array ()) {
- extract ( $ variables , EXTR_SKIP);
- ob_start ();
- include "./page.tpl.php" ;
- $ contents = ob_get_contents ();
- ob_end_clean ();
- exit ( $ contents );
- }
Copy Source | Copy HTML
- function get_image_path ( $ size , $ color , $ text , $ textcolor , $ nocache = FALSE) {
- // File
- $ dirname = 'cache /' . $ color -> color. '/' . $ size -> width. '/' . $ size -> height. '/' . $ textcolor -> color;
- $ filename = $ dirname . '/' .trim ( $ text ). '.png' ;
- if (! is_file ( $ filename ) || $ nocache ) {
- // Create a directory if necessary
- if (! is_dir ( $ dirname )) {
- mkdir ( $ dirname , 0777 , TRUE);
- }
- // Create an image
- $ image = imagecreatetruecolor ( $ size -> width, $ size -> height);
- // Colour
- $ rgb = imagecolorallocate ( $ image , $ color -> red, $ color -> green, $ color -> blue);
- // Fill with color
- imagefilledrectangle ( $ image , 0 , 0 , $ size -> width, $ size -> height, $ rgb );
- // Text Size
- $ textsize = 16 ;
- // Text coordinates
- $ coordinates = imageftbbox ( 16 , 0 , 'fonts / Arial.ttf' , $ text );
- $ x = ( $ size -> width - $ coordinates [ 2 ]) / 2 ;
- $ y = ( $ size -> height - $ coordinates [ 5 ]) / 2 ;
- // Writing Text
- $ textrgb = imagecolorallocate ( $ image , $ textcolor -> red, $ textcolor -> green, $ textcolor -> blue);
- imagefttext ( $ image , $ textsize , 0 , $ x , $ y , $ textrgb , 'fonts / Verdana.ttf' , $ text );
- // Save
- imagepng ( $ image , $ filename , 9 );
- }
- return $ filename ;
- }
Copy Source | Copy HTML
- <! DOCTYPE html PUBLIC "- // W3C // DTD XHTML 1.0 Strict // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- < html xmlns = "http://www.w3.org/1999/xhtml" xml: lang = "en" lang = "en" dir = "ltr">
- < head >
- < meta http-equiv = "Content-Type" content = "text / html; charset = utf-8" />
- < title > BannerMaker Beta 1.0 </ title >
- </ head >
- < body >
- < p > Use link: < strong > http: // <? php print $ _SERVER [ 'HTTP_HOST' ]; ? > / WIDTHxHEIGHT / COLOR / TEXT / TEXTCOLOR </ strong > </ p >
- < p > Example: <a href = "http: // <? php print $ _SERVER ['HTTP_HOST'];?> / 468x60 / CCFFAA / Hello world! / 000000" > http: // <? php print $ _SERVER [ 'HTTP_HOST' ]; ? > / 468x60 / CCFFAA / Hello world! / 000000 </ a > </ p >
- <? php if ($ image ):? >
- < p > < img src = "/ < ? php print $ image ;? > " alt = "" /> </ p >
- <? php endif ; ? >
- </ body >
- </ html >
Source: https://habr.com/ru/post/104724/
All Articles