コード例 #1
0
ファイル: secretimage.php プロジェクト: horrabin/opendb
function render_secret_image($random_num)
{
    $gdImage = new GDImage(get_opendb_image_type());
    $gdImage->createImage('code_bg');
    $image =& $gdImage->getImage();
    $text_color = ImageColorAllocate($image, 80, 80, 80);
    header("Cache-control: no-store");
    header("Pragma: no-store");
    header("Expires: 0");
    CenterImageString($image, 100, get_secret_image_code($random_num), 5, 7, $text_color);
    $gdImage->sendImage();
    unset($gdImage);
}
コード例 #2
0
 }
 $text1 = isset($_GET['text1']) && $_GET['text1'] != '' ? trim(stripinput($_GET['text1'])) : '';
 $text2 = isset($_GET['text2']) && $_GET['text2'] != '' ? trim(stripinput($_GET['text2'])) : '';
 $size1 = isset($_GET['size1']) && isnum($_GET['size1']) && in_array(intval($_GET['size1']), array(12, 16, 24, 32, 48)) ? intval($_GET['size1']) : 32;
 $size2 = isset($_GET['size2']) && isnum($_GET['size2']) && in_array(intval($_GET['size2']), array(12, 16, 24, 32, 48)) ? intval($_GET['size2']) : 32;
 $font1 = isset($_GET['font1']) && isnum($_GET['font1']) && in_array(intval($_GET['font1']), array(1, 2, 3, 4, 5)) ? intval($_GET['font1']) : 1;
 $font2 = isset($_GET['font2']) && isnum($_GET['font2']) && in_array(intval($_GET['font2']), array(1, 2, 3, 4, 5)) ? intval($_GET['font2']) : 1;
 $color1_array = html2rgb($_GET['color1']);
 $color1 = imagecolorallocate($im, $color1_array[0], $color1_array[1], $color1_array[2]);
 $color2_array = html2rgb($_GET['color2']);
 $color2 = imagecolorallocate($im, $color2_array[0], $color2_array[1], $color2_array[2]);
 if ($text1 != '') {
     CenterImageString($im, $gen_type, $image_res[0], $image_res[1], $text1, $size1, $color1, $font1, 1);
 }
 if ($text2 != '') {
     CenterImageString($im, $gen_type, $image_res[0], $image_res[1], $text2, $size2, $color2, $font2, 2);
 }
 if (isset($_GET['action']) && $_GET['action'] == "save") {
     $get_id = dbquery("SELECT mem_id FROM " . DB_GEM_MEMS . " ORDER BY mem_id DESC LIMIT 1");
     if (dbrows($get_id)) {
         $get_id = dbarray($get_id);
         $id = $get_id['mem_id'] + 1;
     } else {
         $id = 1;
     }
     imagejpeg($im, INFUSIONS . "al_genmem/asset/images/" . $id . ".jpg", 100);
     $result = dbquery("INSERT INTO " . DB_GEM_MEMS . " (mem_type,mem_text1,mem_text2,mem_gen_id,mem_datestamp,mem_image,mem_rating,mem_voters,mem_views) VALUES\n        ('" . $gen_type . "','" . $text1 . "','" . $text2 . "','" . $_GET['image'] . "','" . time() . "','" . $id . ".jpg','0','','0')");
     print json_encode(array('result' => 'success', 'id' => mysql_insert_id()));
 } else {
     header('Content-Type: image/jpeg');
     imagejpeg($im, null, 100);