Upload And Preview Image Without Refresh

When we use the iframeSubmit function, we’ll have the form point to upload.php for image submissions and the result will be loaded within the iframe (which is now a hidden element in the page). The upload.php script should process the submission and generate an iframe content which will call the function defined and passed by iframeSubmit, with the results of the operation.

That’s the key.

From: Upload and display an image without a page refresh.

地震.css

地震.css

html { 
    -webkit-filter: grayscale(100%);
    -moz-filter: grayscale(100%);
    -ms-filter: grayscale(100%);
    -o-filter: grayscale(100%);
    filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);
    zoom: 1;
}

Smarty Replace Line Breaks

{$var|regex_replace:”/[\r\n]/” : ” “}

Object comparison in JavaScript

http://stackoverflow.com/questions/1068834/object-comparison-in-javascript

Why not JSON.stringify it then compare?

  1. JSON.stringify removes properties that are set to undefined.
  2. What if the data is the same but the order of the keys is different?
  3. String performance.

screen.height, screen.availHeight, window.innerHeight

屏幕分辨率高度,屏幕内可用高度(桌面去掉任务栏,浏览器可用高度),浏览器内可用高度

$.getWinSize = function() {
    if (window.innerWidth != undefined) {
        return [window.innerWidth, window.innerHeight];
    } else {
        var body = document.body, de = document.documentElement;
        return [Math.max(de.clientWidth, body.clientWidth), Math.max(de.clientHeight, body.clientHeight)];
    }
};

CodeIgniter Rest Server

http://net.tutsplus.com/tutorials/php/working-with-restful-services-in-codeigniter-2/

You’ll need another file: /application/libraries/Format.php.

Read Request Payload in Codeigniter

I was using Codeigniter with Backbone. When I try to call the save() method in the Backbone it sent a POST Request to the server. But it sends data to the server using a Request Payload and not the standard Form Data approach that jQuery, and standard HTML forms submit with.. After a bit study I think there are two easy way to handle this.

On the front end you can enable Backbone.emulateJSON() or on the server side, $requestBody = json_decode(file_get_contents('php://input'),true);.

I heard something like $this->request->body but it never works.