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]

 

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.

So Failsail has ended

So Failsail has ended kind of, sitting on the bus home to Stockholm now. And all I can really say is…
“just jumping jermans with jackets and jpses”
Well, yes, you won’t get much of it, I can see that.

Have had a great time, but alot of failage, all from hitting head in stuff til dropping anchor and fishing cable. We have done the most really, except sailing… Damn weather, had good weather three days, where one of them where first day where we where going in Oslofjorden and not really a good place to start sailing at maybe with a big phat boat.

So we really just had two days of good sailing, rest was really laying in harbour due to class 1 warnings or going on engien. But then, we had a great time, I did anyway.

Started raining the last night when we where going to leave, so on that part we have been real lucky, just sun sun sun, as you may have seen on the lobster pics.
But still, no wind or wind on wrong way. As you see on the last days sailing there is one part when we go backwards some… Well, we sailed there, back. Thats where we swapped to engie and continued for alot of hours, and more hours since Skärhamn was full.

Then we came to the most fail harbour ever… Marstrand, the most expensive piece of junk I have ever seen or been at. 300 SEK per night for no water, shitty spot just at harbour entrance and 40 meter to electricity.
A lot of Q Q now but it did really suck, what sucked even more that the guy we had rented the boat of came one hour later then said + he was going to put a smaller boat into the water that took around one hour extra more.
which made us come quite late home.
Then Patrik and Helene had to leave the car too, so they didn’t have to think about that afterwards.

Well shortly again, I had a great time, a lot of failage but still a good time.
Thanks everyone!