Esempio n. 1
0
function finaliseMainAdItem($propertyInfo, $jsonObject, $dest, $imgUrl)
{
    $templateDir = array();
    $templateDirWeb = array();
    makeTemplateDir($propertyInfo, $templateDir, $templateDirWeb);
    $mainImg = imagecreatefromjpeg($imgUrl);
    $mainImg2 = imagecreatefromjpeg($imgUrl);
    $no_features = 3;
    if ($propertyInfo['no_car'] == "N/A") {
        $no_features = 2;
    }
    // $no_features = 2;
    allocateTemplates($mainImg, $jsonObject, $templateDir, "auction", $no_features);
    allocateTemplates($mainImg2, $jsonObject, $templateDir, "justlisted", $no_features);
    fillText($mainImg, $jsonObject, $propertyInfo, $templateDir, "auction", $no_features);
    fillText($mainImg2, $jsonObject, $propertyInfo, $templateDir, "justlisted", $no_features);
    // $dest = "{$_SERVER['DOCUMENT_ROOT']}/myApp/api/assets/testDraw/";
    imagejpeg($mainImg, $dest . "0.jpg", 100);
    imagejpeg($mainImg2, $dest . "00.jpg", 100);
    imagedestroy($mainImg);
    imagedestroy($mainImg2);
    // allocateLogo (imgUrls, $jsonObject, $templateDir);
}
Esempio n. 2
0
function createAd($propertyInfo, $imgs, &$finalised)
{
    // download imgs
    $dir = "{$_SERVER['DOCUMENT_ROOT']}/api/assets/testDownload/";
    $imgUrls = array();
    downloadAll($imgs, $dir, $imgUrls);
    // print_arr ($imgUrls);
    // resize them
    $resizedUrls = array();
    resizeAll($imgs, $propertyInfo['agency_localDir'], $resizedUrls);
    // print_arr ($resizedUrls);
    $templateDir = array();
    $templateDirWeb = array();
    makeTemplateDir($propertyInfo, $templateDir, $templateDirWeb);
    // put templates into imgs
    $jsonObject = get_json_object($propertyInfo['agency_localDir']);
    $dest = "{$_SERVER['DOCUMENT_ROOT']}/api/assets/testFinal/";
    $finalised[0] = "/api/assets/testFinal/" . "0.jpg";
    $finalised[1] = "/api/assets/testFinal/" . "00.jpg";
    finaliseMainAdItem($propertyInfo, $jsonObject, $dest, $resizedUrls[0]);
    allocateLogo($resizedUrls, $jsonObject, $dest, $templateDir, $finalised);
    print_arr($finalised);
    foreach ($finalised as $oup) {
        echo "<img src='" . $oup . "' />" . "<br />" . "<br />";
    }
}