function whatToDo($url) { $pm = new PictshareModel(); $data = $pm->urlToData($url); if (!is_array($data) || !$data['hash']) { if (UPLOAD_FORM_LOCATION && $url == UPLOAD_FORM_LOCATION || !UPLOAD_FORM_LOCATION && ($url = '/')) { $upload_answer = $pm->ProcessUploads(); if ($_POST['submit'] == $pm->translate(3) && $upload_answer) { $o = $upload_answer; } else { $o .= $pm->renderUploadForm(); } $vars['content'] = $o; $vars['slogan'] = $pm->translate(2); } if (!$vars && LOW_PROFILE) { header('HTTP/1.0 404 Not Found'); exit; } else { if (!$vars) { $vars['content'] = $pm->translate(12); $vars['slogan'] = $pm->translate(2); } } render($vars); } else { renderImage($data); } }
public function renderImage($size = null, $css = '') { if ($this->val('product_image')) { global $images; $images->renderImage($this->val('product_image'), $size, $this->val('product_name'), $css); } else { renderImage('no-image.png', t('Image missing'), $size); } }
<?php global $globals, $config; ?> <div class="header basic-bg spaced"> <div class="row"> <div class="col-md-2 text-left"> <a href="<?php echo $config['base_url']; ?> " alt="<?php echo t('Home'); ?> "> <?php renderImage('logo.jpg', 'Logo', 'img-circle img-responsive logo'); ?> </a> </div> <div class="col-md-4"> <span class="main-title"><?php echo $globals['site_title']; ?> </span> </div> <div class="col-md-6 text-right"> <?php renderBlock('menu'); renderBlock('cart');
<div class="table-responsive panel panel-default"> <table class="table"> <tbody> <?php foreach ($products as $product) { ?> <tr class="item" id="cart_prod_<?php echo $product->val('product_id'); ?> "> <td> <?php if ($product->val('product_image')) { $images->renderImage($product->val('product_image'), 'mini-thumb'); } else { renderImage('no-image.png', 'missing image', 'mini-thumb'); } ?> </td> <td> <?php renderLink($product->val('alias_url'), $product->val('product_name')); ?> </td> <td class="text-right"> <span><?php echo formatPrice($product->val('product_price')); ?> </span> <input type="hidden" id="item-price-<?php
$images = array(); } $image_id = upload_image($dbc, $name, $subject, $discription); insert_into_segment($dbc, $segment_id, $image_id); array_push($images, $image_id); if (!empty($images)) { echo '<div class = "span6">'; echo "<legend>已上传如下图片!您可继续上传图片,或<a href = \"article.php?id={$article_id}#s{$segment_id}\">返回</a>.</legend>"; $left = true; foreach ($images as $cur_image) { if ($left) { echo '<ul class = "thumbnails">'; renderImage($dbc, $cur_image); $left = false; } else { renderImage($dbc, $cur_image); echo '</ul>'; $left = true; } } echo '</div >'; } } ?> <div class="span3"> <form enctype="multipart/form-data" class="form-horizontal" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> ">
<?php /** * Created by PhpStorm. * User: vasilepop * Date: 8/10/15 * Time: 5:35 PM */ function renderImage($imageResource, $imageType) { switch ($imageType) { case 'jpg': case 'jpeg': header('Content-type: image/jpeg'); imagejpeg($imageResource); break; case 'png': header('Content-type: image/png'); imagepng($imageResource); break; default: throw new DomainException('Unknown image type: ' . $imageType); break; } imagedestroy($imageResource); } renderImage("me.jpg", "jpg"); renderImage("me", "png"); renderImage("me", "ico");