File: image_thumbnail_client.php

package info (click to toggle)
php-gearman 2.0.2%2B1.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 868 kB
  • ctags: 723
  • sloc: ansic: 7,092; php: 826; xml: 570; sh: 32; makefile: 1
file content (46 lines) | stat: -rw-r--r-- 1,112 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/*
 * Gearman PHP Extension
 *
 * Copyright (C) 2008 James M. Luedke (jluedke@jamesluedke.com)
 *                           Eric Day (eday@oddments.org)
 *
 * Use and distribution licensed under the PHP license.  See
 * the LICENSE file in this directory for full text.
 */

/* create our object */
$gmc= new GearmanClient();

/* add the default server */
$gmc->addServer();

$data['src']= $_SERVER['argv'][1];
$data['dest']= "small_" . $_SERVER['argv'][1];
$data['x']= 200;
$data['y']= NULL;

/* run reverse client */
do
{
    $value = $gmc->do("shrink_image", serialize($data));
    switch ($gmc->returnCode())
    {
        case GEARMAN_WORK_DATA:
            echo "DATA: $value\n";
            break;
        case GEARMAN_SUCCESS:
            echo "SUCCESS: $value\n";
            break;
        case GEARMAN_WORK_STATUS:
            list($numerator, $denominator)= $gmc->doStatus();
            echo "Status: $numerator/$denominator\n";
            break;
        default:
            echo "ERR: " . $gmc->error() . "\n";
    }
}
while($gmc->returnCode() != GEARMAN_SUCCESS);

echo "DONE: $value\n";