Imagemagick Resize Rule

These are some pattern codes for resize using Imagemagick

Pattern 1 (resize to 960×550 px)
( Original size width > Target size width ) and (Original size height > Target size height) and ( (Original size width / Original size height) > (Target size width / Target size height)

pattern1

convert [original.jpg]  -resize x550 -gravity center -crop 960×550+0+0 +repage [result.jpg]
or
convert [original.jpg] -resize x550^ -gravity center -extent 960×550 [result.jpg]

Pattern 2 (resize to 960×550 px)
( Original size width > Target size width ) and (Original size height > Target size height) and ( (Original size width / Original size height) < (Target size width / Target size height)

pattern2

convert [original.jpg]  -resize 960x^ -gravity center -crop 960×550+0+0 +repage [result.jpg]
or
convert [original.jpg] -resize 960x^ -gravity center -extent 960×550 [result.jpg]

Continue reading “Imagemagick Resize Rule”

Imagemagick Resize Rule

Cookie Using JSON Format Javascript

Actually, some weeks ago, my senior made me create cookie using JSON format. Ok, keep calm, this is the first time, i create a cookie, i really blank about it 😀 haha the problem is using JSON format too..

I tried creating this cookie in java but the framework that i use, had a problem converting to json formatted cookie.

So, i use javascript instead 😀 and this one is really simple 😀

JSON result format should be, (sort by the newest data)

{"user":[{"name":"sunny","idcard":"88657890"},{"name":"ananti","idcard":"13456778"}]}

Below code is HTML.

Name : <input id="name" type="text" />
ID Card : <input id="idcard" type="text" />
<input onclick="setCookie('name','idcard',1)" type="button" value="Set Cookie" />

Continue reading “Cookie Using JSON Format Javascript”

Cookie Using JSON Format Javascript

Ajax in JSF 1.2

This is the first time, i use JSF framework. Need time to understand this framework’s flow 😀
Then, i got job for making AJAX in JSF, wuuw~ When i google it, i found many tutorials, but most of them using JSF 2.0.
I need AJAX for JSF 1.2 because i’m using JSF 1.2 in current development.
In JSF 2.0. you can easily use AJAX because this is one of the new features in ver 2.0.
In the other hand, you need more effort to do AJAX in JSF 1.2. 😉
After searching it for a while, i found a tutorial for creating AJAX using PhaseListener in JSF 1.2.
So, i wanna share this code 😀
I use this in Websphere, Oracle for database, and JSON for response data format.

Okay, Let’s see the step by step,

Continue reading “Ajax in JSF 1.2”

Ajax in JSF 1.2