Tim Widget

We’ve just created a new widget, one that displays recent posts from a selected category, with TimThumb-resized images extracted from the Media Library.

Here are a couple of screenshots:

screenshot-1

screenshot-2

Download it via the official WordPress plugins repository.

Posted in WordPress Plugins | Tagged , , , , , | 5 Comments

Image resize plugin

We’ve just finished a new plugin: one that integrates the image resize script TimThumb with TinyMCE, the WYSIWYG editor that WordPress uses.

You can download it here via the official WordPress repository.

screenshot-1

This is the little resize button:

screenshot-2

Posted in WordPress Plugins | Tagged , , , , | 14 Comments

bbPress în limba română

bbPress-Logo1-150x150

Acum câteva zile am constatat că avem nevoie de un bbPress în limba română, şi că traducerea încă nu există, aşa că ne-am apucat să o facem noi, şi cu ocazia asta o punem şi la dispoziţia dumneavoastră.

Traducerea e realizată pe baza fişierului POT oficial pentru versiunea 1.0.2. Pentru alte traduceri de bbPress, căutaţi pe forumurile oficiale bbPress.

Instrucţiuni de instalare a traducerii

Creaţi un director my-languages în rădăcina instalării bbPress.

Descărcaţi fişierul bb102.zip.

Despachetaţi şi încărcaţi fişierul ro_RO.mo în directorul proaspăt creat my-languages.

Deschideţi fişierul bb-config.php din rădăcina instalării bbPress, căutaţi linia:

define( 'BB_LANG', '' );

şi schimbaţi-o în:

define( 'BB_LANG', 'ro_RO' );

Pentru aducerea de modificări la traducere

Dacă se doreşte modificarea traducerii, puteţi folosi fişierul ro_RO.po din arhiva descărcată anterior şi îl puteţi edita cu un editor cum ar fi Poedit.

Posted in General | Tagged , , , , , , | 2 Comments

Making darkness or brightness transparent

Let’s say you have the picture of a flame and you want to change the background. In order to do that you first must make the background transparent. But how can you do that? You can do it by hand using a brush but it’s not quite the effect I was looking for. So I figured there must be a way to automatically adjust the transparency of each pixel depending on it’s darkness.

This gave me the chance to play around with PHP GD, and I must say I’m quite impressed. It seems to be a really powerful image processing tool. Here is the script I came up with, and here it is in action.

Before

Before

After

After

Pretty neat, huh? Here’s the script so you can see it without having to download the zip file.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// $url: the URL of the image you want to be processed. It can also be a local filename.
// $type: 0 for brightness, anything else for darkness.
// $mode: 0 for theoretical mode, anything else for Photoshop mode.
 
function transparent($url, $type=1, $mode=1){
// Create the old image
$old_image = imagecreatefromstring(file_get_contents($url));
 
// Create the new image of the same size as the old one
list($x_size, $y_size) = getimagesize($url);
$new_image = imagecreatetruecolor($x_size, $y_size);
 
// Turn off alpha blending and set alpha flag for our new image
imagealphablending($new_image, false);
imagesavealpha($new_image, true);
 
// Do the following for each pixel
for($y=0; $y<$y_size; $y++){
	for($x=0; $x<$x_size; $x++){
		// get it's color
		$rgb = imagecolorat($old_image, $x, $y);
		// and get the R, G and B components of the color
		$old_color = imagecolorsforindex($old_image, $rgb);
		$r = $old_color['red'];
		$g = $old_color['green'];
		$b = $old_color['blue'];
 
		// Define brightness:
		if ($mode) $brightness = max($r, $g, $b); // photoshop mode OR
		else $brightness = (max($r, $g, $b) + min($r, $g, $b)) / 2; // theoretical mode
 
		// Define darkness:
		$darkness = (255 - $brightness);
 
		// Generate transparence:
		if($type) $alpha = $darkness / 2; // for darkness OR
		else $alpha = $brightness / 2; // for brightness
 
		// Define the new color, same as the old one, but with alpha transparency
		$new_color = imagecolorallocatealpha($new_image, $r, $g, $b, $alpha);
		// Set that color to the pixel in the new image
		imagesetpixel($new_image, $x, $y, $new_color);
	}
}
 
// Output image to browser
header('Content-Type: image/png');
imagepng($new_image);
 
// Destroy all images in the end
imagedestroy($old_image);
imagedestroy($new_image);
}

Update: There’s also a Photoshop plugin for doing something similar, but it costs 27 euros.

Posted in PHP | Tagged , , , | 6 Comments

WordPress 2.8 în limba română

Traducerea versiunii 2.8 este cam 50% bazată pe traducerea versiunii 2.7 realizată de Catholica NETwork. În plus am mai adus următoarele modificări faţă de versiunea celor de la Catholica NETwork:

  • Cuvintele theme, template şi style nu mai sunt toate traduse prin şablon, ci theme este acum temă, template a rămas şablon, iar style este stil.
  • Version nu mai este tradus ca şi Traducere realizată de CNET.ro | Versiunea, ci acum este doar Versiunea.

Traducerile sunt realizate pe baza fişierelor POT oficiale. Pentru alte traduceri ale WordPress-ului vizitaţi pagina oficială WordPress in Your Language.

Instrucţiuni de instalare a traducerii

Descărcaţi fişierul de traducere pentru versiunea dumneavoastră de WordPress:

WordPress MU (doar pentru cei care ştiu despre ce e vorba):

Despachetaţi şi încărcaţi fişierul ro_RO.mo în directorul dumneavoastră de WordPress wp-content/languages. Dacă directorul nu există, va trebui să îl creaţi.

Deschideţi fişierul wp-config.php, căutaţi linia:

define ('WPLANG', '');

şi schimbaţi-o în:

define ('WPLANG', 'ro_RO');

Pentru aducerea de modificări la traduceri

Dacă se doreşte modificarea traducerilor, puteţi folosi fişierul ro_RO.po din arhiva descărcată anterior şi îl puteţi edita cu un editor cum ar fi Poedit. Mai multe informaţii despre traducerea WordPress-ului se pot găsi pe pagina Translating WordPress a Codexului.

Posted in General | Tagged , , , , , , , | 51 Comments

Software for SMEs

Last week I had the wonderful opportunity to be invited to participate at a series of conferences, being part of a bigger project called “Software for competitive SMEs”.

The project was founded by the Romanian Association for Electronic and Software Industry in collaboration with Timisoara’s Software Business Incubator.

The primary purpose of the project was to inform the local small business owners, from Oravita and Moldova Noua, about the ways they could use software and web applications in order to increase productivity and support automation.

The project also facilitated the contact between local software firms and SMEs from towns situated in Caras-Severin and Timis counties, in order to contribute to the economic development of the area.

I had the chance to speak to a lot of wonderful people. I’ve noticed that each community has a bunch of representative individuals, that really understand the problems of their community and that can give you the best inputs in order to build up the best solution.

conf1

conf2

They were really opened to the solutions provided by our company, eager to learn more about online presence, web applications and software that could improve their business. It was a great experience because we could actually talk on real cases, and provide practical solutions.

conf3

After the conference we visited some of the most important touristic attractions, which got us to actually feel the historic pulse of that region.

Among them are: The Old Theatre – “Mihai Eminescu” from Oravita, the oldest Romanian casino (many people say it’s the first European casino) as well as some of the agrotouristic pensions situated on the shore of the Danube River.

teatru

casino

Thanks again to all the people involved in this project. It really was an enriching experience!

Posted in General | Tagged , , | Leave a comment

New Plugin: Talky WordPress

We have a new plugin, one that makes WordPress talk! It adds talky sound events for publishing and deleting posts or pages, plugin activation and deactivation and theme activation.

It uses SoundManager 2 for playing sounds using JavaScript, by wrapping and extending Flash 8’s sound API.

You can grab it at the official WordPress plugin repository.

Posted in WordPress Plugins | Tagged , , , | 7 Comments

404 email alert

Here is a little PHP code snippet to add to your 404 page, in order to get an email alert with all sorts of useful data, each time a 404 page is accessed.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
if(isset($_SERVER['HTTP_REFERER'])) {
    $ref=$_SERVER['HTTP_REFERER'];
}
else{
	$ref='none';
}
 
$sitename='Reflection Media';
 
$recipient = 'mail@gmail.com';
$subject = 'New '.$sitename.' 404 accessed';
$mail_body = '
A new 404 page has been accessed:
 
The accessed URI was: '.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'
The user's IP address: '.$_SERVER['REMOTE_ADDR'].'
The user's Internet browser: '.$_SERVER['HTTP_USER_AGENT'].'
The URI from where your user came: '.$ref.'
';
$header = 'From: '.$sitename.' 404 page <no-reply@mail.com>rn';
 
mail($recipient, $subject, $mail_body, $header);
Posted in PHP | Tagged , , , | 1 Comment

Fun with numbers

Remember the math puzzle?

You have the following sequence of terms:
1
11
21
1211
111221
312211
13112221

What is the algorithm? What is the next term?

— Spoiler warning. Continue at your own risk. —
Read More »

Posted in General | Tagged , , , , , | 1 Comment

Math puzzle

A friend of mine has recently introduced me to a quite puzzling math puzzle.

You have the following sequence of terms:
1
11
21
1211
111221
312211
13112221

And you have to figure out what the algorithm is. To prove yourself you’ve got it, just write down the next term. The answer will come in a future post.

Posted in General | Tagged , | 4 Comments