if (!file_exists($pngFilePath)) { $pngconv = new swfrender(); $pngconv->renderPage($pdfdoc, $swfdoc, $page, $subfolder); } if ($configManager->getConfig('allowcache')) { setCacheHeaders(); } if (!$configManager->getConfig('allowcache') || $configManager->getConfig('allowcache') && endOrRespond()) { header('Content-Type: image/jpeg'); if (file_exists($jpgCachePath)) { echo file_get_contents($jpgCachePath); } else { if ($resolution == null) { echo file_get_contents(generateImage($pngFilePath, $jpgCachePath, 1200, 'png', 'jpg')); } else { echo file_get_contents(generateImage($pngFilePath, $jpgCachePath, $resolution, 'png', 'jpg')); } } } } else { if (strlen($messages) == 0 || $messages == "[OK]") { $messages = "[Incorrect file specified, please check your path]"; } } } if ($format == "jpgpageslice") { $path = $pngFilePath; //getting extension type (jpg, png, etc) $type = explode(".", $path); $ext = strtolower($type[sizeof($type) - 1]); $ext = !in_array($ext, array("jpeg", "png", "gif")) ? "jpeg" : $ext;
function refreshCache($source_file, $cache_file, $resolution) { if (file_exists($cache_file)) { // not modified if (filemtime($cache_file) >= filemtime($source_file)) { return $cache_file; } // modified, clear it unlink($cache_file); } return generateImage($source_file, $cache_file, $resolution); }
return $layer['width'] . "x" . $layer['height']; } if (isset($_POST['input'])) { ini_set('memory_limit', '-1'); ini_set('max_execution_time', 300); $input = $_POST['input']; $match = preg_match($regex, $input, $matches); if ($match) { $xy = generateImage($imagelink, $matches[2], $matches[6]); $succes = true; } elseif (filter_var(trim($_POST['input']), FILTER_VALIDATE_URL)) { //input is a URL $content = file_get_contents(trim($_POST['input'])); $match = preg_match($regex, $content, $matches); if ($match) { $xy = generateImage($imagelink, $matches[2], $matches[6]); $succes = true; } else { $error = true; } } else { $error = true; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Dememorixer</title> <link rel="stylesheet" type="text/css" href="view.css" media="all">
<?php include 'function.php'; //Set the Content Type header('Content-type: image/jpeg'); // Set Text to Be Printed On Image $data = explode(';', $_POST['name']); foreach ($data as $a) { generateImage('sertifikat2', $a); } header('Location: index.php'); ?>
function generateCerti($eventAction, $eventId, $pmcId, $userId, $userRank) { if ($eventAction == 'event') { if (strcmp($userRank, '-1') == 0) { $userCertiRank = -1; } else { $userCertiRank = -2; } $getCertiImgQuery = "SELECT `certificate_id`,`certificate_image` FROM `events_certificate` WHERE `user_rank` = '{$userCertiRank}' AND `page_moduleComponentId`='{$pmcId}' "; $eventName = getEventName($pmcId, $eventId); } else { if ($eventAction == 'workshop') { $getCertiImgQuery = "SELECT `certificate_id`,`certificate_image` FROM `events_certificate` WHERE `user_rank` = '{$eventId}' AND `page_moduleComponentId`='{$pmcId}' AND `event_id` = '-1'"; } } $getCertiImgRes = mysql_query($getCertiImgQuery) or displayerror(mysql_error()); if (mysql_num_rows($getCertiImgRes) == 0) { $getEventsCertiQuery = "SELECT `certificate_id`,`certificate_image` FROM `events_certificate` WHERE `user_rank` = '{$userCertiRank}' AND `page_moduleComponentId`='{$pmcId}' AND `event_id` = '-1'"; // return $getEventsCertiQuery; $getCertiImgRes = mysql_query($getEventsCertiQuery) or displayerror(mysql_error()); } $certiImage = ""; $posXString = ""; $posYString = ""; $posX2String = ""; $posY2String = ""; $certiValueString = ""; while ($certiDetails = mysql_fetch_assoc($getCertiImgRes)) { $certiImage = $certiDetails['certificate_image']; $certiId = $certiDetails['certificate_id']; // return $certiImage; // return $certiId; //Get Certificate Details From evets_certficate_details $getCertiDetailsQuery = "SELECT `certificate_posx`,`certificate_posy`,`certificate_posx2`,`certificate_posy2`,`form_value_id` FROM `events_certificate_details` WHERE `page_moduleComponentId`='{$pmcId}' AND `certificate_id`='{$certiId}'"; // return $getCertiDetailsQuery; $getCertiDetailsRes = mysql_query($getCertiDetailsQuery) or displayerror(mysql_error()); // return mysql_num_rows($getCertiDetailsRes); //Get Form Values From form_elementdesc //Form_value_id=1 -> Rank //Form_value_id=2 -> Event Name //Form_value_id=3 -> PArticipant Name //Form_value_id=4 -> Coll while ($getValues = mysql_fetch_assoc($getCertiDetailsRes)) { //User Rank // echo $getValues['form_value_id']; // die(); if ($getValues['form_value_id'] == 1) { //imagettftext($rotatedImage, 20, 90, $getValues['certificate_posx'], $getValues['certificate_posy'], $color, $font, $userRank); // return $userRank; $posXString .= $getValues['certificate_posx'] . "::"; $posYString .= $getValues['certificate_posy'] . "::"; $posX2String .= $getValues['certificate_posx2'] . "::"; $posY2String .= $getValues['certificate_posy2'] . "::"; $participantRank = ""; if (strcmp($userRank, "1") == 0) { $participantRank = "1st"; } else { if (strcmp($userRank, "2") == 0) { $participantRank = "2nd"; } else { if (strcmp($userRank, "3") == 0) { $participantRank = "3rd"; } else { if (strcmp($userRank, "4") == 0) { $participantRank = "4th"; } else { if (strcmp($userRank, "5") == 0) { $participantRank = "5th"; } else { if (strcmp($userRank, "6") == 0) { $participantRank = "6th"; } else { if (strcmp($userRank, "2") == 0) { $participantRank = "2nd"; } else { if (strcmp($userRank, "7") == 0) { $participantRank = "7th"; } else { if (strcmp($userRank, "8") == 0) { $participantRank = "8th"; } else { if (strcmp($userRank, "9") == 0) { $participantRank = "9th"; } else { if (strcmp($userRank, "10") == 0) { $participantRank = "10th"; } else { if (strcmp($userRank, "11") == 0) { $participantRank = "11th"; } else { if (strcmp($userRank, "12") == 0) { $participantRank = "12th"; } else { if (strcmp($userRank, "13") == 0) { $participantRank = "13th"; } else { if (strcmp($userRank, "14") == 0) { $participantRank = "14th"; } else { if (strcmp($userRank, "15") == 0) { $participantRank = "15th"; } else { if (strcmp($userRank, "16") == 0) { $participantRank = "16th"; } } } } } } } } } } } } } } } } } /* //switch($userRank){ /*case 1:$participantRank = "1st"; break; case 2:$participantRank = "2nd"; break; case 3:$participantRank = "3rd"; break; case 4:$participantRank="4th"; break; case 5:$$participantRank="5th"; break; case 6:$participantRank="7th"; break; case 8:$participantRank="8th"; break; case 9:$participantRank="9th"; break; case 10:$participantRank="10th"; break;*/ //} $certiValueString .= $participantRank . "::"; } else { if ($getValues['form_value_id'] == 2) { //Get Event Name // imagettftext($rotatedImage, 20, 90, $getValues['certificate_posx'], $getValues['certificate_posy'], $color, $font, $eventName); $posXString .= $getValues['certificate_posx'] . "::"; $posYString .= $getValues['certificate_posy'] . "::"; $posX2String .= $getValues['certificate_posx2'] . "::"; $posY2String .= $getValues['certificate_posy2'] . "::"; $eventName = str_replace(" Workshop", "", $eventName); $certiValueString .= $eventName . "::"; } else { if ($getValues['form_value_id'] == 3) { $getUserNameQuery = "SELECT `user_fullname` FROM `" . MYSQL_DATABASE_PREFIX . "users` WHERE `user_id`='{$userId}'"; $getUserNameRes = mysql_query($getUserNameQuery) or displayerror(mysql_error()); $userName = ucwords_specific(strtolower(mysql_result($getUserNameRes, 0)), "."); $posXString .= $getValues['certificate_posx'] . "::"; $posYString .= $getValues['certificate_posy'] . "::"; $posX2String .= $getValues['certificate_posx2'] . "::"; $posY2String .= $getValues['certificate_posy2'] . "::"; $certiValueString .= $userName . "::"; } else { if ($getValues['form_value_id'] == 4) { //Check if modified value exists in events_edited_form //Else get value from form_elementdata //Change1 $collId = retCollFormId(); $formPmcId = retglobalPmcId(); //$getFormValuesQuery = "SELECT `form_elementdata`.`form_elementdata` FROM `form_elementdata` INNER JOIN `events_form` ON `form_elementdata`.`page_moduleComponentId`=`events_form`.`form_id` // AND `events_form`.`event_id`='{$eventId}' AND `events_form`.`page_moduleComponentId`='{$pmcId}' AND `form_elementdata`.`user_id`='{$printParticipant['user_id']}' AND `form_elementdata`.`form_elementid`='{$getValues['form_value_id']}'"; $getFormValuesQuery = "SELECT `form_elementdata` FROM `form_elementdata` WHERE `page_moduleComponentId`='{$formPmcId}' AND `form_elementid`='{$collId}' AND `user_id`='{$userId}'"; $getFormValuesRes = mysql_query($getFormValuesQuery) or displayerror(mysql_error()); // return mysql_num_rows($getFormValuesQuery); while ($formData = mysql_fetch_assoc($getFormValuesRes)) { // imagettftext($rotatedImage, 20, 90, $getValues['certificate_posx'], $getValues['certificate_posy'], $color, $font, $formData['form_elementdata']); if ($formData['form_elementdata'] == "Others") { $collFormId = retOtherCollFormId(); $getCollNameQuery = "SELECT `form_elementdata` FROM `form_elementdata` WHERE `page_moduleComponentId`='{$formPmcId}' AND `user_id`='{$userId}' AND `form_elementid`='{$collFormId}'"; $getCollNameRes = mysql_query($getCollNameQuery) or displayerror(mysql_error()); $collName = ucwords_specific(strtolower(mysql_result($getCollNameRes, 0)), "."); } else { $collName = ucwords_specific(strtolower($formData['form_elementdata']), "."); } $posXString .= $getValues['certificate_posx'] . "::"; $posYString .= $getValues['certificate_posy'] . "::"; $posX2String .= $getValues['certificate_posx2'] . "::"; $posY2String .= $getValues['certificate_posy2'] . "::"; $certiValueString .= $collName . "::"; } } } } } } } $posXString = rtrim($posXString, "::"); $posYString = rtrim($posYString, "::"); $posX2String = rtrim($posX2String, "::"); $posY2String = rtrim($posY2String, "::"); $certiValueString = rtrim($certiValueString, "::"); //$certiImagePage = "Hello".$certiImage; $certiImagePage = "<img style='width:100%;height:100%' src='" . generateImage($certiImage, $posXString, $posYString, $posX2String, $posY2String, $certiValueString) . "'>"; return $certiImagePage; }
$return = generateImage($imagelink, $matches[2], $matches[count($matches) - 1]); $xy = $return["xy"]; $succes = $return['succes']; } elseif (!$succes && filter_var($input, FILTER_VALIDATE_URL)) { //input is a URL foreach ($beeldbanken as $beeldbank) { if (preg_match('`https?:\\/\\/(www\\.)?' . $beeldbank['url'] . '\\/detail\\/[a-z0-9\\-]{36}\\/media\\/([a-z0-9\\-]{36})`', $input, $matches)) { $return = generateImage($imagelink, $beeldbank['tla'], $matches[count($matches) - 1]); $xy = $return["xy"]; $succes = $return['succes']; } } if (!$succes) { $content = file_get_contents(trim($_POST['input'])); if (preg_match($regex, $content, $matches)) { $return = generateImage($imagelink, $matches[2], $matches[count($matches) - 1]); $xy = $return["xy"]; $succes = $return["succes"]; } elseif (preg_match('`files\\.archieven\\.nl\\/php\\/get_thumb\\.php\\?adt_id=([0-9]{2,4})&(amp;)?toegang=([A-Z0-9]{2,3})&(amp;)?id=[0-9]{9}&(amp;)?file=([0-9A-Z]{2,3})(%5C|-)([0-9]{2,7})\\.jpg`', $content, $matches)) { $imagelink = "http://files.archieven.nl/" . $matches[1] . "/f/" . $matches[3] . "/" . $matches[6] . "/" . $matches[8] . ".jpg"; //http://files.archieven.nl/69/f/THA/27/986.jpg $xy = ""; $succes = true; } } } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head>
<?php header('Content-Encoding: UTF-8'); header('Content-Type: image/svg+xml'); include_once 'includes/session.php'; include_once 'includes/functions_avatars.php'; include_once 'includes/functions_steam.php'; include_once 'includes/functions_cast.php'; include_once 'includes/functions_castvideo.php'; // are we logged in? no → leave if (!login_check()) { header("Location: /"); exit; } else { $me = $_SESSION['u']; } // are we admin? no → leave if (in_array($me, getAdmins())) { } else { header("Location: /"); exit; } /* User wanting to see a specific cast, and shownotes file exists */ if ($season !== "00" && $episode !== "00") { // We do no testing here, as this function will return an image even if // this episode does not exist (it will test the user, though!) print generateImage($season, $episode); }
$html = "<span id='msg-error'><b> Please try again another user is active...<a href='http://zawikawm.com/photomix/'>Back</a></b></span>"; echo $html; exit; } else { $imageSave = imagejpeg($source_img, $file, 100); imagedestroy($source_img); // destroy from memory //$uploadimgname=$_FILES["file"]["name"]; //$data = file_get_contents($remotefile,true); //file_put_contents("upload/upload.jpg", $data); //echo "Stored in: " . "upload/upload.jpg"; resize($file, $file, 320, 320); copy($file, "upload/mix.jpg"); unlink($file); //delete upload file generateImage($_SESSION["pic_id"], "upload/mix.jpg"); FBSDK("upload/mix.jpg"); //echo $html;//output download image and link } } else { echo "<span id='msg-error'><b>Photo too large or Invalid. Lim lemtang lo hi.</b></span>"; } } else { if (isset($_REQUEST['code'])) { FBSDK("upload/mix.jpg"); } else { echo "Somthing worng for parameter"; } } } function resize($source_image, $destination, $tn_w, $tn_h, $quality = 100, $wmsource = false)
if (!file_exists($pngFilePath)) { $pngconv = new swfrender(); $pngconv->renderPage($pdfdoc, $swfdoc, $page, $subfolder); } if ($configManager->getConfig('allowcache')) { setCacheHeaders(); } if (!$configManager->getConfig('allowcache') || $configManager->getConfig('allowcache') && endOrRespond()) { header('Content-Type: image/jpeg'); if (file_exists($jpgCachePath)) { echo readfile($jpgCachePath); } else { if ($resolution == null) { echo readfile(generateImage($pngFilePath, $jpgCachePath, 1200, 'png', 'jpg')); } else { echo readfile(generateImage($pngFilePath, $jpgCachePath, $resolution, 'png', 'jpg')); } } } } else { if (strlen($messages) == 0 || $messages == "[OK]") { $messages = "[Incorrect file specified, please check your path]"; } } } if ($format == "jpgpageslice") { $path = $pngFilePath; //getting extension type (jpg, png, etc) $type = explode(".", $path); $ext = strtolower($type[sizeof($type) - 1]); $ext = !in_array($ext, array("jpeg", "png", "gif")) ? "jpeg" : $ext;
<?php include "generator.php"; header("Content-type: image/png"); header('Content-Disposition: attachment; filename="image.png"'); imagepng(generateImage());
/** * Generates a video that we can upload to YouTube. This calls generateImage( ) directly. * Note this is long-running, and as such needs to call set_time_limit( ) * @param integer $season the season * @param integer $episode and episode for this specific cast episode * @return string location of the rendered file on the server */ function generateVideo($season, $episode) { global $avatarKeyPath; /* TODO find a better location to write to! */ set_time_limit(360); $slug = 's' . $season . 'e' . $episode; $meta = getCastHeader($slug); $audiofile = $meta['ABSFILENAME'] . '.ogg'; if (!file_exists($audiofile)) { return false; } $svgcontents = generateImage($season, $episode); $svgcontents = str_replace('/avatars', './avatars', $svgcontents); $svgcontents = str_replace('/images/', './images/', $svgcontents); $svgcontents = str_replace('/fonts/', './fonts/', $svgcontents); /* TODO: reg match on http references, check local cache for file and either dl & use, or use */ $svgfile = $avatarKeyPath . '/' . $meta['FILENAME'] . '.svg'; $pngfile = $avatarKeyPath . '/' . $meta['FILENAME'] . '.png'; $mp4filetmp = $avatarKeyPath . '/' . $meta['FILENAME'] . '-temp.mp4'; $mp4file = $avatarKeyPath . '/' . $meta['FILENAME'] . '.mp4'; $svgfileref = fopen($svgfile, 'w'); fwrite($svgfileref, $svgcontents); fclose($svgfileref); if (!file_exists($svgfile)) { return false; } $commandthumbnail = "rsvg-convert {$svgfile} > {$pngfile}"; print "Running: " . $commandthumbnail . "\n"; echo shell_exec($commandthumbnail . ' 2>&1'); if (!file_exists($pngfile)) { return false; } $commandvideo = "ffmpeg -y -loglevel warning -loop 1 -framerate 1 -i {$pngfile} -i {$audiofile} -c:v libx264 -tune stillimage -pix_fmt yuv420p -c:a aac -strict experimental -b:a 192k -shortest {$mp4filetmp}"; print "Running: " . $commandvideo . "\n"; echo shell_exec($commandvideo . ' 2>&1'); if (!file_exists($mp4filetmp)) { return false; } $commandfaststart = "qt-faststart {$mp4filetmp} {$mp4file}"; print "Running: " . $commandfaststart . "\n"; echo shell_exec($commandfaststart . ' 2>&1'); if (!file_exists($mp4file)) { return false; } return $mp4file; }