Ajaxorized

Phototype: image manipulation with Javascript

May 24, 2008

Lately I had same crazy thoughts on coding a javascript wrapper to manipulate images rendered on the server-side. I decided to do some test which eventually resulted in phototype, a client/server-side library, based on prototype, which supports all kinds of image manipulations. On the serverside the library is powered by combination of PHP/GD that renders the image. With phototype, you are able to rotate, resize, flip and do some other cool effects to images. Let's start a quick tour. (more...)

Add to: del.icio.us Reddit Slashdot Digg Facebook Technorati Google StumbleUpon Windows Live Yahoo
topFiled under: Prototype, Javascript, PHP | Willem @ 2:39 pm | Comments (64)

Multiple Upload Solution; Using Javascript, Flash and PHP

October 19, 2007

Thanks for the introduction Willem and hi all! Willem asked me to write some posts on additional topics like Flash, Actionscript and so on. I hope you will enjoy some of my findings, codes, tips or stories.

For my first contribution i'd like to start sharing a script i wrote a few months ago.

A problem i often encouter is that people, often customers, would like to upload multiple files all together, instead of, what you often see, one file at the time. Of course a very simple solution is to put multiple HTML upload fields on a page, but obviously we could think of a better solution. There are many alternatives on the internet, but most of them aren't customizable and as a real webdeveloper, i would like to create my own solution of course. That is why i created a solution combining three popular webtechnologies; Javascript, Flash and PHP; Javascript constrols the visual aspects, while Flash in combination with PHP handles the upload process.

Since Flash 8, the possibility to communicate between Flash and Javascript is improved, so you can communicate easily using the Flash's ExternalInterface API. With this you can call javascript functions from Actionscript and pass any number of arguments of any data type and vice versa!

To see a working example of my multiple upload solution, click here (no files will be actually uploaded).

I also helped willem out with the design and think we came up with a nice look for this weblog. As you can see at the top we included a menu and added the page 'projects'. I hope we will be able to give this page some content and if i improved my multiple upload script, i will add this as a project. Untill then, you can download the source of this first version here.

Add to: del.icio.us Reddit Slashdot Digg Facebook Technorati Google StumbleUpon Windows Live Yahoo
topFiled under: Javascript, PHP, Flash, Actionscript | martijn @ 8:17 pm | Comments (11)

Include Google Analytics in your static HTML website

July 10, 2007

A few months ago I was assigned to a project where a company, while their new site was being developed, wanted to track the visitors on their website for marketing purposes. The only problem was that their current website was constructed with Frontpage a few years ago and consisted of hundreds of static HTML pages. Since I'm (very) lazy I was not planning to copy paste the whole thing, I figured out a way to include the GA code in every static html page.

First, I wrote a .htaccess file which rewrites all (including files in subdirs) .html and .htm pages to addgoogleanalytics.php:

RewriteEngine on
RewriteRule ^(.*).html?$ addgoogleanalytics.php?file=$0

Wow, it that all? Yes it is. So helloworld.html will be rewrited to addgoogleanalytics.php?file=helloworld.html, and the user won't even notice. Now, take a look at addgoogleanalytics.php:

<?php
/* Open the given file and add the google analytics code */
$sData = file_get_contents($_GET['file']);
$sData = str_replace("</body>", "
<script src=\"http://www.google-analytics.com/urchin.js\" type=\"text/javascript\">
</script>
<script type=\"text/javascript\">
_uacct = \"UA-1808705-3\";
urchinTracker();
</script>
 
</body>", $sData);
echo $sData;
?>

Enjoy.

Add to: del.icio.us Reddit Slashdot Digg Facebook Technorati Google StumbleUpon Windows Live Yahoo
topFiled under: Uncategorized, PHP, Apache, Code | Willem @ 12:10 pm | Comments (1)