コード例 #1
0
ファイル: proxy.php プロジェクト: jelmervdl/favicon-badge
function download_to_data_uri($uri)
{
    $curl = curl_init($uri);
    curl_setopt($curl, CURLOPT_BINARYTRANSFER, true);
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_MAXREDIRS, 5);
    curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);
    $data = curl_exec($curl);
    $mimetype = curl_getinfo($curl, CURLINFO_CONTENT_TYPE);
    if (!$mimetype) {
        $mimetype = 'application/octet-stream';
    }
    return data_uri($data, $mimetype);
}
コード例 #2
0
ファイル: watchphoto.php プロジェクト: vantezzen/synchro
              
            <div class="row">
                
				<?php 
if (!isset($_GET["file"])) {
    echo "Please choose a file you want to view!";
} else {
    ?>
                <section class="panel">
                          <header class="panel-heading">
                            <?php 
    echo $_GET["file"];
    ?>
                          </header>
                          <div class="panel-body"><img src="<?php 
    echo data_uri("files/" . $_GET["file"], "image/png");
    ?>
" class="img-responsive">
                    </div></section>
                              <?php 
}
?>
                              
                
				
			</div><!--/.row-->
		
			
                  <div class="widget-foot">
                    <!-- Footer goes here -->
                  </div>
コード例 #3
0
ファイル: watchvideo.php プロジェクト: vantezzen/synchro
            <div class="row">

				<?php 
if (!isset($_GET["file"])) {
    echo "Please choose a file you want to view!";
} else {
    ?>
                <section class="panel">
                          <header class="panel-heading">
                            <?php 
    echo $_GET["file"];
    ?>
                          </header>
                          <div class="panel-body"><video src="<?php 
    echo data_uri("files/" . $_GET["file"], getMime($_GET["file"]));
    ?>
" class="img-responsive" />
                    </div></section>
                              <?php 
}
?>



			</div><!--/.row-->


                  <div class="widget-foot">
                    <!-- Footer goes here -->
                  </div>
コード例 #4
0
//Function to generate $data to be sent to curlSetOpt_PostFields.
//This is similar to http_build_query, but I couldn't find a similar one for use with CURL, so I wrote my own.
function createCurlPostFieldsData($inputArray)
{
    $string = "{";
    foreach ($inputArray as $tag => $value) {
        $string = $string . "\"" . $tag . "\":\"" . $value . "\",";
    }
    $string = rtrim($string, ',');
    $string = $string . "}";
    return $string;
}
//Define the DICOM Tags & PNG File, build query
$patientID = $_POST['PatientID'];
// unable to inject PatientID directly into orthanc 0.8.2, need to modify the new DICOM instance in another 2 more calls
$dicomTags = array("PatientName" => $_POST['PatientName'], "SOPClassUID" => "1.2.840.10008.5.1.4.1.1.7", "Modality" => "SC", "SeriesDescription" => "Consent Form", "StudyDate" => date(Ymd), "SeriesDate" => date(Ymd), "StudyTime" => "000000", "SeriesTime" => "000000", "PixelData" => data_uri('image/png'));
$data = createCurlPostFieldsData($dicomTags);
//Create a DICOM instance
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $orthanc . '/tools/create-dicom');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
$resp = curl_exec($curl);
curl_close($curl);
//The following 3 steps (replace, create and delete) can be removed once PatientID can be injected into create-dicom
//Replace PatientID and return modified DCM binary data
$elements = explode("\"", $resp);
$instance = str_replace("/instances/", "", $elements[7]);
$target = $orthanc . "/instances/" . $instance . "/modify";
$data = "{\"Replace\":{\"PatientID\":\"" . $patientID . "\"}}";
コード例 #5
0
ファイル: upload.php プロジェクト: Covert-Inferno/callme
<?php

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    define("WIDTH_I", "240");
    define("HEIGHT_I", "240");
    $fileName = $_FILES["pic"]["name"];
    $fileTmpLoc = $_FILES["pic"]["tmp_name"];
    $moveResult = move_uploaded_file($fileTmpLoc, "{$fileName}");
    if ($moveResult == true) {
        make_thumb($fileName, $fileName, WIDTH_I, HEIGHT_I);
        echo "<div id='data'>" . data_uri($fileName) . "</div>";
        @unlink($fileName);
    }
}
function get_extension($str)
{
    $str = strtolower($str);
    $arr = explode('.', $str);
    if (sizeof($arr) < 2) {
        return "";
    }
    return $str = $arr[sizeof($arr) - 1];
}
function data_uri($file)
{
    $type = get_extension($file);
    $mime = 'image/' . $type;
    $contents = file_get_contents($file);
    $base64 = base64_encode($contents);
    return 'data:' . $mime . ';base64,' . $base64;
}
コード例 #6
0
		<a href="https://instagram.com/pilgrimchurchredding/"><img width="24" height="24" src="<?php 
echo data_uri('instagram');
?>
" /></a>
		<?php 
if (is_user_logged_in()) {
    ?>
<a href="<?php 
    if (current_user_can('edit_pages') && is_singular()) {
        echo get_edit_post_link();
    } else {
        echo admin_url();
    }
    ?>
"><img width="24" height="24" src="<?php 
    echo data_uri('wordpress');
    ?>
" /></a><?php 
}
?>
	</nav>

	<header class="site__body__header">
		<a class="header__title" href="<?php 
echo get_bloginfo('url');
?>
">
			<h1>Redding Pilgrim<br />Congregational Church, UCC</h1>
		</a>
		<nav class="header__nav"><?php 
wp_nav_menu($menu_args);
コード例 #7
0
ファイル: PrintLetter.php プロジェクト: jafarkhani/rtfund
    }
    $content .= " موضوع : " . $LetterObj->LetterTitle . "<br><br></span></b>";
    $content .= str_replace("\r\n", "", $LetterObj->context);
    if (isset($_POST["sign"])) {
        $sign = $dt[0]["regSign"] != "" ? "background-image:url('" . data_uri($dt[0]["regSign"], 'image/jpeg') . "')" : "";
    } else {
        $sign = "";
    }
    $content .= "<table width=100%><tr><td><div class=signDiv style=\"" . $sign . "\"><b>" . $dt[0]["RegPersonName"] . "</b><br>" . $dt[0]["PostName"] . "</div></td></tr></table>";
}
if ($LetterObj->LetterType == "OUTCOME") {
    $content .= $LetterObj->OrgPost . " " . $LetterObj->organization . "<br>";
    $content .= " موضوع : " . $LetterObj->LetterTitle . "<br><br></b>";
    $content .= str_replace("\r\n", "", $LetterObj->context);
    if (isset($_POST["sign"])) {
        $sign = $LetterObj->IsSigned == "YES" ? "background-image:url('" . data_uri($dt[0]["signer"], 'image/jpeg') . "')" : "";
    } else {
        $sign = "";
    }
    $content .= "<table width=100%><tr><td><div class=signDiv style=\"" . $sign . "\"><b>" . $dt[0]["SignPersonName"] . "</b><br>" . $dt[0]["PostName"] . "</div></td></tr></table>";
}
foreach ($dt as $row) {
    if ($row["FromPersonID"] != $LetterObj->PersonID || $row["IsCopy"] == "NO") {
        continue;
    }
    $content .= "<b>" . "رونوشت : " . ($row["sex"] == "MALE" ? "جناب آقای " : "سرکار خانم ") . $row['ToPersonName'] . "<br></b>";
}
if ($LetterObj->OuterCopies != "") {
    $LetterObj->OuterCopies = str_replace("\r\n", " , ", $LetterObj->OuterCopies);
    $content .= "<br><b> رونوشت به : " . $LetterObj->OuterCopies . "</b><br>";
}
コード例 #8
0
ファイル: data_uri.php プロジェクト: sea75300/fanpresscm3
<?php

function data_uri($file, $mime)
{
    $contents = file_get_contents($file);
    $base64 = base64_encode($contents);
    return 'data:' . $mime . ';base64,' . $base64;
}
print data_uri(dirname(__DIR__) . '/core/theme/logo.png', 'image/png') . PHP_EOL . PHP_EOL;
コード例 #9
0
ファイル: functions.inc.php プロジェクト: Natolumin/observium
function graph_error($string)
{
    global $vars, $config, $graphfile;
    $vars['bg'] = "FFBBBB";
    include $config['html_dir'] . "/includes/graphs/common.inc.php";
    $rrd_options .= " HRULE:0#555555";
    $rrd_options .= " --title='" . $string . "'";
    $rrd_options = preg_replace('/ --(start|end)(\\s+\\d+)?/', '', $rrd_options);
    // Remove start/end from error graph
    if ($height > 99) {
        rrdtool_graph($graphfile, $rrd_options);
        //$woo = shell_exec($rrd_cmd);
        //if (OBS_DEBUG) { echo("<pre>".$rrd_cmd."</pre>"); }
        if (is_file($graphfile)) {
            if (!OBS_DEBUG) {
                header('Content-type: image/png');
                header('Content-Length: ' . filesize($graphfile));
                header('Content-Disposition: inline; filename="' . basename($graphfile) . '"');
                $fd = fopen($graphfile, 'r');
                fpassthru($fd);
                fclose($fd);
            } else {
                echo '<img src="' . data_uri($graphfile, 'image/png') . '" alt="graph" />';
            }
            unlink($graphfile);
            #      exit();
        }
    } else {
        if (!OBS_DEBUG) {
            $im = imagecreate($width, $height);
            $orange = imagecolorallocate($im, 255, 225, 225);
            $px = (imagesx($im) - 7.5 * strlen($string)) / 2;
            imagestring($im, 3, $px, $height / 2 - 8, $string, imagecolorallocate($im, 128, 0, 0));
            header('Content-type: image/png');
            imagepng($im);
            imagedestroy($im);
        }
        #    exit();
    }
}
コード例 #10
0
ファイル: login.php プロジェクト: Covert-Inferno/callme
							<form action="login.php"  method="post" enctype="multipart/form-data" class="form-signin">
								<div class="row">
									<div class="col-md-6">
										<h2 class="form-signin-heading">Please fill in</h2>
										<label for="inputEmail">Email address</label>
										<input type="email" name="inputEmail" class="form-control" placeholder="Email address" required="" autofocus="">
										<label for="inputName">Name</label>
										<input type="text" name="inputName" class="form-control" placeholder="Name" maxlength="12" data-toggle="tooltip" data-placement="top" title="" data-original-title="Max 12 chars" required="">
										<label for="inputPassword">Password</label>
										<input type="password" name="inputPassword" class="form-control" placeholder="Password" required="">
										<input type="text" name="inputImg" class="hidden">
										<br>
									</div>
									<div class="col-md-6" style="text-align: center;">
										<img id="selected-img" src="<?php 
echo data_uri('css/images/user_anonym_allow.png');
?>
" data-toggle="tooltip" data-placement="top" title="" data-original-title="Click to change">
									</div>
								</div>
								<button name="regClick" class="btn btn-lg btn-primary" type="submit">Register</button>
							</form>
						</div>
						<div id="forgotten-form" class="tab-pane fade">
							<form action="login.php" method="POST" class="form-forgott">
								<div class="row">
									<div class="col-md-6 col-centered">
										<br>
										<label for="ForgottEmail">Email address</label>
										<input type="email" name="ForgottEmail" class="form-control" placeholder="Email address" required="" autofocus="">
										<br>
コード例 #11
0
<?php

/**
 * File who allow to Adkintun web page to make request without CORS problem.
 * @author Michel Llorens <*****@*****.**>
 * @version 1.0
 */
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods "GET"');
function data_uri($file, $mime)
{
    $contents = file_get_contents($file);
    $base64 = base64_encode($contents);
    return 'data:' . $mime . ';base64,' . $base64;
}
$ans = data_uri('space.jpg', 'image/jpg');
$encoded = json_encode($ans);
header('Content-Length: ' . strlen($encoded));
header('Content-type: application/json');
exit($encoded);
コード例 #12
0
ファイル: watchpdf.php プロジェクト: vantezzen/synchro
            <!--main content start-->
            <section id="main-content">
                <section class="wrapper">            
                    <!--overview start-->

                    <div class="row">

                        <?php 
if (!isset($_GET["file"])) {
    echo "Please choose a file you want to view!";
} else {
    ?>
                        <section class="panel">
                            <div class="panel-body">
                                <object data="<?php 
    echo data_uri("files/" . $_GET["file"], "application/pdf");
    ?>
" type="application/pdf" width="100%" id="pdf">
                                    <p>We're sorry, but it looks like your browser isn't capable displaying this document.</a></p>
                                </object>
                            </div></section>
                        <?php 
}
?>



                    </div><!--/.row-->


                    <div class="widget-foot">
コード例 #13
0
ファイル: ShowFile.php プロジェクト: jafarkhani/rtfund
        header('Content-disposition: filename=file.' . $dt[0]["FileType"]);
        header('Content-type: jpg');
        header('Pragma: no-cache');
        header('Expires: 0');
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
        header('Pragma: public');
        header("Content-Transfer-Encoding: binary");
        echo $FileContent;
        die;
    }
}
function data_uri($content, $mime)
{
    $base64 = base64_encode($content);
    return 'data:' . $mime . ';base64,' . $base64;
}
echo '<script src="/generalUI/pdfobject.js"></script>';
echo '<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>';
echo "<center>";
foreach ($dt as $file) {
    $FileContent = $file["FileContent"] . file_get_contents(getenv("DOCUMENT_ROOT") . "/storage/documents/" . $file["RowID"] . "." . $file["FileType"]);
    echo "<div style='width:100%;' align=center><hr>صفحه " . $file["PageNo"] . "<hr></div>";
    echo $file["FileType"];
    if ($file["FileType"] == "pdf") {
        echo "<img id=pdf_DIV_" . $file["RowID"] . ">";
        echo '<script>PDFObject.embed("' . data_uri($FileContent, "pdf") . '", "#pdf_DIV_' . $file["RowID"] . '");</script>';
    } else {
        echo "<img src=" . data_uri($FileContent, 'image/jpeg') . " /></br>";
    }
}
echo "</center>";
コード例 #14
0
ファイル: dataUri.php プロジェクト: nallar/GrEmB
<?php

function data_uri($file, $mime)
{
    $contents = file_get_contents($file);
    $base64 = base64_encode($contents);
    return "data:{$mime};base64,{$base64}";
}
echo data_uri("C:\\Users\\Ross\\Downloads/cursor-sizef.png", 'image/png');
コード例 #15
0
ファイル: LetterContent.php プロジェクト: jafarkhani/rtfund
if ($LetterObj->LetterType == "INNER") {
    foreach ($dt as $row) {
        if ($row["FromPersonID"] != $LetterObj->PersonID || $row["IsCopy"] == "YES") {
            continue;
        }
        $content .= $row["sex"] == "MALE" ? "جناب آقای " : "سرکار خانم ";
        $content .= $row['ToPersonName'] . "<br>";
    }
    $content .= "<br> موضوع : " . $LetterObj->LetterTitle . "<br><br></b>";
    $content .= str_replace("\r\n", "", $LetterObj->context);
    $sign = $dt[0]["regSign"] != "" ? "background-image:url(\"" . data_uri($dt[0]["regSign"], 'image/jpeg') . "\")" : "";
    $content .= "<table width=100%><tr><td><div class=signDiv style=" . $sign . "><b>" . $dt[0]["RegPersonName"] . "</b><br><br>" . $dt[0]["PostName"] . "</div></td></tr></table>";
}
if ($LetterObj->LetterType == "OUTCOME") {
    $content .= $LetterObj->OrgPost . " " . $LetterObj->organization . "<br>";
    $content .= "<br> موضوع : " . $LetterObj->LetterTitle . "<br><br></b>";
    $content .= str_replace("\r\n", "", $LetterObj->context);
    $sign = $LetterObj->IsSigned == "YES" && $dt[0]["signer"] != "" ? "background-image:url(\"" . data_uri($dt[0]["signer"], 'image/jpeg') . "\")" : "";
    $content .= "<table width=100%><tr><td><div class=signDiv style=" . $sign . "><b>" . $dt[0]["SignPersonName"] . "</b><br><br>" . $dt[0]["PostName"] . "</div></td></tr></table>";
}
foreach ($dt as $row) {
    if ($row["FromPersonID"] != $LetterObj->PersonID || $row["IsCopy"] == "NO") {
        continue;
    }
    $content .= "<b> رونوشت : " . ($row["sex"] == "MALE" ? "جناب آقای " : "سرکار خانم ") . $row['ToPersonName'] . "<br></b>";
}
if ($LetterObj->OuterCopies != "") {
    $LetterObj->OuterCopies = str_replace("\r\n", " , ", $LetterObj->OuterCopies);
    $content .= "<br><b> رونوشت خارج از سازمان : " . $LetterObj->OuterCopies . "</b><br>";
}
echo $content;
コード例 #16
0
ファイル: graph.inc.php プロジェクト: greggcz/librenms
                 $dst_im = imagecreatetruecolor($src_w, $src_h);
                 imagesavealpha($dst_im, true);
                 $white = imagecolorallocate($dst_im, 255, 255, 255);
                 $trans_colour = imagecolorallocatealpha($dst_im, 0, 0, 0, 127);
                 imagefill($dst_im, 0, 0, $trans_colour);
                 imagecopy($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h);
                 imagepng($dst_im);
                 imagedestroy($dst_im);
             } else {
                 $fd = fopen($graphfile, 'r');
                 fpassthru($fd);
                 fclose($fd);
             }
         } else {
             echo `ls -l {$graphfile}`;
             echo '<img src="' . data_uri($graphfile, 'image/png') . '" alt="graph" />';
         }
         unlink($graphfile);
     } else {
         if ($width < 200) {
             graph_error('Draw Error');
         } else {
             graph_error('Error Drawing Graph');
         }
     }
 } else {
     if ($width < 200) {
         graph_error('Def Error');
     } else {
         graph_error('Graph Definition Error');
     }
コード例 #17
0
ファイル: index.php プロジェクト: awwthentic1234/hey
<?php

function data_uri($file, $mime)
{
    $contents = file_get_contents($file);
    $base64 = base64_encode($contents);
    return 'data:' . $mime . ';base64,' . $base64;
}
?>

<object type="application/x-shockwave-flash" id="flashMovie1" data="<?php 
echo data_uri('flash.swf', 'image/jpeg');
?>
" width="300" height="600" style="visibility: visible;"><param name="wmode" value="opaque"></object>


<img src="<?php 
echo data_uri('img.jpeg', 'image/jpeg');
?>
" alt="An elephant" />