The code is almost closer with my previous article, just change function resize_image to square_image
function crop_img($imgname, $scale, $filename) {
$filetype = $this->getFileExtension($imgname);
$filetype = strtolower($filetype);
switch($filetype){
case "jpeg":
case "jpg":
$img_src = ImageCreateFromjpeg ($imgname);
break;
case "gif":
$img_src = imagecreatefromgif ($imgname);
break;
case "png":
$img_src = imagecreatefrompng ($imgname);
break;
}
$width = imagesx($img_src);
$height...
Upload and Resize Image in CakePHP


I have spent many hours to see articles about resizing and uploading image in cakePHP, almost of them are sounding sucks for me like resizing on View by accessing or injecting the url or copy paste by another written without testing code. Event I was trying to convert AkImage from Akelos (Closer to ImageMagick in Rails) but got bunch of errors.
Any way i got article from sobbour website, but i am not satisfied with the code because the component automatically resize for big and thumb by 2 method...

SharedObject in Sever Using NetConnection or by Remote


A few days ago i have problem how to implement my live streaming using SharedObject in Red5 because usually SharedObject, as i know, only good implementable for local only (like getting or store cookies), before implemented to my live streaming application, i created simple chat application to remote SharedObject :<?xml version="1.0" encoding="utf-8"?><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="creationComplete()"><mx:Script source="streaming.as"/><mx:TextInput...

Anti Spam Email For Your Rails Page with Javascript


In your view : <%= js_antispam_email_link('username@domain.com') %>Code for your helper# Takes in an email address and (optionally) anchor text,# its purpose is to obfuscate email addresses so spiders and# spammers can't harvest them.def js_antispam_email_link(email, linktext=email)user, domain = email.split('@')user = html_obfuscate(user)domain = html_obfuscate(domain)# if linktext wasn't specified, throw encoded email address builder into js document.write statementlinktext = "'+'#{user}'+'@'+'#{domain}'+'"...

Move To Word Press


I Recently Move my Blog To Wordpress --> inobject.wordpress....

Track Total Coverage of Your Test Unit Code with RCOV


Hi All :I just want share my testing with Ruby coverage code or Rcov. It is fun (for me, dont know for others) playing with Rcov report, i think it is like bugs tracking but i dont know other people called it or maybe it is like tool to coverage test your application codes. First think you have to do is installing the gem :gem install rcovand then write simple code to run it as rake then save it in your_app/lib/tasks :require 'rcov/rcovtask' namespace :test donamespace :coverage dodesc "Delete aggregate...

Subscribe to:
Posts (Atom)