Smush-it API by coddler - how to? (I am using codeigniter but any php example would be great)
I am wondering if someone can help me with the smushit api by coddler I am not really sure how to use it.

See here https://github.com/codler/Smush.it-API

here is are the two accessing methods written by coddler one for file, one for url:

    function smush_file($optimize_file, $optimized_file=null) {
    	if (!$optimized_file) $optimized_file = $optimize_file;
    	
    	// send file
    	$obj = new Fetch_url('http://www.smushit.com/ysmush.it/ws.php', array('files[]' => '@'.$optimize_file), null, null, SMUSH_USER_AGENT);
    	
    	return _smush($obj, $optimized_file);
    }
    
    function smush_url($url, $optimized_file) {
    	
    	// send file
    	$obj = new Fetch_url('http://www.smushit.com/ysmush.it/ws.php?img='.urlencode($url), null, null, null, SMUSH_USER_AGENT);
    	
    	return _smush($obj, $optimized_file);
    }

Now at this point I have an image on my server which I would now like to pass to smush it but I am not really sure how to pass a file (I can pass a url though) but my main problem is how to handle what I get back and overwrite the original file. as I say I am working in codeigniter but if anyone can show me how to do this in php I'm sure I can work it out from there.

Your help is greatly appreciated.
Smush-it API by coddler - how to? (I am using codeigniter but any php example would be great)
===

I am wondering if someone can help me with the smushit api by coddler I am not really sure how to use it.

See here https://github.com/codler/Smush.it-API

here is are the two accessing methods written by coddler one for file, one for url:

    function smush_file($optimize_file, $optimized_file=null) {
    	if (!$optimized_file) $optimized_file = $optimize_file;
    	
    	// send file
    	$obj = new Fetch_url('http://www.smushit.com/ysmush.it/ws.php', array('files[]' => '@'.$optimize_file), null, null, SMUSH_USER_AGENT);
    	
    	return _smush($obj, $optimized_file);
    }
    
    function smush_url($url, $optimized_file) {
    	
    	// send file
    	$obj = new Fetch_url('http://www.smushit.com/ysmush.it/ws.php?img='.urlencode($url), null, null, null, SMUSH_USER_AGENT);
    	
    	return _smush($obj, $optimized_file);
    }

Now at this point I have an image on my server which I would now like to pass to smush it but I am not really sure how to pass a file (I can pass a url though) but my main problem is how to handle what I get back and overwrite the original file. as I say I am working in codeigniter but if anyone can show me how to do this in php I'm sure I can work it out from there.

Your help is greatly appreciated.