Can’t Stop

I’m sitting here, shaking from the cold
The cold that comes with the tiredness,
But I can not leave it – I can not leave the thoughts in peace
I can not stop to wonder – what would be

What would be of everything, if I just got the chance
The chance to show that it was for real
Not some fake try, just to get closer.
But a real try, for something good.

I can not stop to wonder – if she thought the same.
I can not stop to wonder – if it was her choice or not.
I can not stop to wonder – how could that person think like that?
I can’t stop…

Watermark on Hot Linking

I tried to find some script that allowed me to watermark photos that where being hot linked, and just those.
Didn’t find any script that did just what I wanted but found parts of it and then I rewrote and added caching for it.

This script is named /hl/watermark.php there of the “../” in the paths.
The directory “cache” needs to be writeable by the webserver.

You can use most of the available TTF-fonts you just need to upload it to same directory. /hl that is.

The PHP Code:

$font = "./kberry.ttf";

$impath = str_replace("../","", $_GET["image"]);

$cachefile = "./cache/".md5($impath) . ".png";
if (file_exists("../".$impath)) {
$file_md5 = $cachefile.".md5";
$md5_new_file = trim(md5_file("../" . $impath));
$md5_old_file = trim(@file_get_contents($file_md5));
@rename($file_md5, $file_md5.".bak");
$fp = fopen($file_md5, 'w');
fwrite($fp, $md5_new_file);
fclose($fp);

@rename($cachefile.".path", $cachefile.".path.bak");
$fpath = fopen($cachefile.".path", 'w');
fwrite($fpath, "/".$impath);
fclose($fpath);

if(($md5_new_file <> $md5_old_file) || !file_exists($cachefile))
{
$ext = end ( explode ( ".", $impath ) );

switch ( $ext ) {
case "jpg":
$image = imagecreatefromjpeg ( "../" . $impath ); break;
case "jpeg":
$image = imagecreatefromjpeg ( "../" . $impath ); break;
case "png":
$image = imagecreatefrompng ( "../" . $impath ); break;
case "gif":
$image = imagecreatefromgif ( "../" . $impath ); break;
}
$text = "(c) clearshots.se";
$font_size = 28;

$size = imagettfbbox ( $font_size, 0, $font, $text );
$text_width = $size[2] + $size[0] + 8;
$text_height = $size[1] + $size[7];

$image_width = imagesx ( $image );
$image_height = imagesy ( $image );

$text_x = $image_width - $text_width - 5;
$text_y = $image_height - $text_height - 40;

$shadow_x = $text_x + 2;
$shadow_y = $text_y + 2;

imagettftext ( $image, $font_size, 0, $shadow_x, $shadow_y, imagecolorallocate ( $image, 0, 0, 0 ), $font, $text );
imagettftext ( $image, $font_size, 0, $text_x, $text_y, imagecolorallocate ( $image, 255, 195, 60 ), $font, $text );

 

 

header ( “Content-Type: image/png” );

@unlink($cachefile);
imagepng ( $image );
imagepng( $image, $cachefile,0);
imagedestroy ( $image );
}
else
{
@unlink($cachefile.".md5.bak");
@unlink($cachefile.".path.bak");
header ( "Content-Type: image/png" );
readfile($cachefile);
}
} else {
header ( "Content-Type: image/png" );
readfile("./404.png");
}
? >

The .htacess file

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?clearshots.se/.*$ [NC]
RewriteRule (.*.(png|gif|jpeg|jpg)) http://www.clearshots.se/hl/watermark.php?image=$1 [R,L]

 

Jag trodde

Trodde att jag kommit lÀngre.
Trodde att jag klarade allt,
Trodde pÄ mig sjÀlv.

Sen stÄr jag dÀr, hon utanför.
Det var vÀntat, jag visste.
Visste, med min tur
SĂ„ skulle hon, komma hem

Jag gömde mig, allt för att inte
Inte se henne, sÄg honom
Han den nya, hörde henne.
Jag försvann, inombords.

Kunde knappt gÄ
Kunde knappt prata
Trodde att jag kommit lÀngre
Trodde att jag klarade allt.

Men inte.

Life takes some strange turns

On my way home from a last-minute trip to Malmö, went down to visit my maternal grandpa who is in the hospital. Three bigger operations in a quite short times for the same thing.
You do get a bit scared then, felt like shit the last two days before I went down to Malmö.
Both on the Thursday and Friday before the departure of the train, thought came up about old things, that I regret, but that I really have no control over. A decision that was made, a decision that would end up in my minds forever.

It was this old decision that made me go down to Malmö now, to see my maternal grandpa. It was a good visit or me.
When I visited him yesterday he was very tired, but when he heard my voice he started talking with me, though he was tired.
Then he got way to tired and I asked if he wanted to sleep some and we could come back later. And he wanted that, so we came back later after I had cooked food for mom and dad.
He was sleeping then though, but I think he heard us, cause when me and mom talked he started sleeping harder, snoring, together with the roommate.
Me and mom was standing there smiling, it sounded so fun.
Then the nurse comes in and tries to wake him up, cause we where there. I thought, it’s not needed, he needs his sleep.

When we come in today at 14:00 or so, he was awake but laying in bed, he was freezing but he had been up eating, walking. We talked for an hour or so, then he started getting tired and I thought we said he was going to sleep for a while and dad and me where going out and taking some photos. But when we came back he had been up all the time talking with mom.

So the trip in short words – I am much calmer now, feeling better…
And now seven days of work ahead.