#!/bin/bash files=* W=800 H=600 SIZE_TEST="%[fx:(h>$H && w>$W)]"'\n' for f in $files do if [ $(identify -format "$SIZE_TEST" "$f") = 1 ]; then echo "Resize: $f" mogrify -resize ''"$W"x"$H"'' "$f" else echo "Do not resize: $f" fi done
Wednesday, May 24, 2017
Bash to resize images using imageMagick
Taken the idea from unix.stackexchange.com
Tuesday, May 9, 2017
Quick code to test XML-RPC and SOAP 2 in PHP using Magento 1.x
XML-RPC
require_once 'app/Mage.php'; umask(0); Mage::app(); $host = 'http://test.com'; $user = 'user'; $pass = 'pass'; $client = new Zend_XmlRpc_Client($host.'/api/xmlrpc/'); $session = $client->call('login', array($user,$pass)); //call resource sales_order.info $client->call('call', array($session, 'sales_order.info', array('10000001'))); $response = $client->getLastResponse(); $data = $response->getReturnValue(); var_dump($data); $client->call('endSession', array($session));
SOAP 2
ini_set("soap.wsdl_cache_enabled", "0");//no cache $host = 'http://test.com'; $user = 'user'; $pass = 'pass'; $client = new SoapClient($host.'/api/v2_soap/?wsdl'); $sessionId = $client->login($user,$pass); //check available types //$types = $client->__getTypes(); //var_dump($types); //check available functions //$functions = $client->__getFunctions(); //var_dump($functions); $result = $client->salesOrderInfo($sessionId,'900687569'); var_dump($result);
Subscribe to:
Posts (Atom)