示例#1
0
 /**
  * Get the markup to show an image thumbnail
  *
  * This function is a wrapper for show_image() that returns what show_image() would
  * normally simply output.
  *
  * @param mixed $image An image object, image ID, or array of image values
  * @param boolean $die_without_thumbnail Echo nothing if no thumb available? (default behavior 
  *                                       is to make link to full-sized image if no thumb available)
  * @param boolean $show_popup_link Wrap image in link that pops up image popup?
  * @param boolean $show_description Place the image description (i.e. short caption) below the image?
  * @param string $other_text Text to use instead of image description
  * @param boolean $textonly True sets function into textonly mode, which instead of outputting
  *                          image markup outputs a text description linking to image
  * @param boolean $show_author Output the value of the author field below the description?
  * @param string $link_with_url Wrap the image in a link to this URL instead of to image popup
  * @return string XHTML markup
  */
 function get_show_image_html($image, $die_without_thumbnail = false, $show_popup_link = true, $show_description = true, $other_text = '', $textonly = false, $show_author = false, $link_with_url = '')
 {
     ob_start();
     show_image($image, $die_without_thumbnail, $show_popup_link, $show_description, $other_text, $textonly, $show_author, $link_with_url);
     $result = ob_get_contents();
     ob_end_clean();
     return $result;
 }
 function get_teaser_image_markup()
 {
     $markup_string = '';
     $image = $this->passed_vars['teaser_image'];
     if (!empty($image)) {
         $markup_string .= '<div class="teaserImage">';
         ob_start();
         show_image(reset($image), false, false, false, '', '', true, '');
         $markup_string .= ob_get_contents();
         ob_end_clean();
         $markup_string .= '</div>';
     }
     return $markup_string;
 }
示例#3
0
 /**
  * List the reviews
  *
  * @access public
  * @return string
  */
 public function list_reviews()
 {
     $this->load->helper('date');
     $this->load->helper('html_output');
     $start = $this->input->get_post('start') ? $this->input->get_post('start') : 0;
     $limit = $this->input->get_post('limit') ? $this->input->get_post('limit') : MAX_DISPLAY_SEARCH_RESULTS;
     $reviews = $this->reviews_model->get_reviews($start, $limit);
     $records = array();
     if ($reviews !== NULL) {
         foreach ($reviews as $review) {
             $records[] = array('reviews_id' => $review['reviews_id'], 'date_added' => mdate('%Y/%m/%d', human_to_unix($review['date_added'])), 'reviews_rating' => image('images/stars_' . $review['reviews_rating'] . '.png', sprintf(lang('rating_from_5_stars'), $review['reviews_rating'])), 'products_name' => $review['products_name'], 'reviews_status' => $review['reviews_status'], 'code' => show_image($review['languages_code']));
         }
     }
     $this->output->set_output(json_encode(array(EXT_JSON_READER_TOTAL => $this->reviews_model->get_total(), EXT_JSON_READER_ROOT => $records)));
 }
示例#4
0
 /**
  * List guest book
  *
  * @access public
  * @return string
  */
 public function list_guest_books()
 {
     $start = $this->input->get_post('start');
     $limit = $this->input->get_post('limit');
     $start = empty($start) ? 0 : $start;
     $limit = empty($limit) ? MAX_DISPLAY_SEARCH_RESULTS : $limit;
     $guest_books = $this->guest_book_model->get_guest_books($start, $limit);
     $records = array();
     if ($guest_books !== NULL) {
         foreach ($guest_books as $guest_book) {
             $records[] = array('guest_books_id' => $guest_book['guest_books_id'], 'title' => $guest_book['title'], 'email' => $guest_book['email'], 'guest_books_status' => $guest_book['guest_books_status'], 'languages' => show_image($guest_book['code']), 'content' => $guest_book['content'], 'date_added' => mdate('%Y/%m/%d', human_to_unix($guest_book['date_added'])));
         }
     }
     $this->output->set_output(json_encode(array(EXT_JSON_READER_TOTAL => $this->guest_book_model->get_totals(), EXT_JSON_READER_ROOT => $records)));
 }
示例#5
0
 /**
  * List languages
  *
  * @access public
  * @return string
  */
 public function list_languages()
 {
     $start = $this->input->get_post('start') ? $this->input->get_post('start') : 0;
     $limit = $this->input->get_post('limit') ? $this->input->get_post('limit') : MAX_DISPLAY_SEARCH_RESULTS;
     $languages = $this->lang_model->get_languages($start, $limit);
     $records = array();
     if ($languages !== NULL) {
         foreach ($languages as $language) {
             $total_definitions = $this->lang_model->get_total_definitions($language['languages_id']);
             $languages_name = $language['name'];
             //verify that the language is the default language
             if ($language['code'] == DEFAULT_LANGUAGE) {
                 $languages_name .= ' (' . lang('default_entry') . ')';
             }
             $records[] = array('languages_id' => $language['languages_id'], 'code' => $language['code'], 'total_definitions' => $total_definitions, 'languages_name' => $languages_name, 'languages_flag' => show_image($language['code']));
         }
     }
     $this->output->set_output(json_encode(array(EXT_JSON_READER_TOTAL => $this->lang_model->get_total(), EXT_JSON_READER_ROOT => $records)));
 }
示例#6
0
 function get_images_section()
 {
     $str = '';
     $str .= '<ul>';
     foreach ($this->passed_vars['item_images'] as $image) {
         $str .= '<li class="imageChunk">';
         $rsi = new reasonSizedImage();
         $rsi->set_id($image->id());
         $rsi->set_width(400);
         // Uncomment if you want to force a height or crop
         //$rsi->set_height(300);
         //$rsi->set_crop_style('fill');
         ob_start();
         show_image($rsi, false, true, true, '');
         $str .= ob_get_contents();
         ob_end_clean();
         $str .= '</li>';
     }
     $str .= '</ul>';
     return $str;
 }
 function get_teaser_image_markup()
 {
     $markup_string = '';
     $image = $this->passed_vars['teaser_image'];
     if (!empty($image)) {
         $markup_string .= '<div class="teaserImage">';
         if (is_array($image)) {
             $image = reset($image);
         }
         $rsi = new reasonSizedImage();
         $rsi->set_id($image->id());
         $rsi->set_width(600);
         $rsi->set_height(600);
         $rsi->set_crop_style('fill');
         ob_start();
         show_image($rsi, true, false, false, '');
         $markup_string .= ob_get_contents();
         ob_end_clean();
         $markup_string .= '</div>';
     }
     return $markup_string;
 }
示例#8
0
}
print_spacer(20);
print_box(format_text($strtable), 'generalbox', 'intro');
print_spacer(20);
// Print the main part of the page ----------------------------------
print_spacer(20);
print_heading(format_string(get_string('correction', 'blended')));
print_box(format_text(get_string('imagepagedesc', 'blended')), 'generalbox', 'intro');
print_spacer(20);
//print $imagepath;
$imgout = get_field('blended_images', 'imgout', 'jobid', $jobid, 'activitycode', $acode, 'pageindex', $pageindex);
//print "<BR>IMGOUT".$imgout;
$imagepath = get_image_src($imgout);
//echo "<BR>IMGPATHNEW";
//print $imagepath;
show_image($imagepath, $course);
if ($navigationpage == "showdetails.php") {
    $volver = "{$CFG->wwwroot}/mod/blended/showdetails.php?id={$course->id}&acode={$acode}&jobid={$jobid}";
}
if ($navigationpage == "reviewdetails.php") {
    $volver = "{$CFG->wwwroot}/mod/blended/reviewdetails.php?id={$course->id}&acode={$acode}&jobid={$jobid}";
}
print_continue($volver);
echo "<BR><BR><center>";
helpbutton($page = 'image', get_string('pagehelp', 'blended'), $module = 'blended', $image = true, $linktext = true, $text = '', $return = false, $imagetext = '');
echo "</center>";
print_footer($course);
function show_image($imagepath, $course)
{
    //print $imagepath;
    $src = create_image_url($imagepath, $course);
示例#9
0
    $msg .= $msg != "" ? "<p>" . $lang['lightbox_no_images'] : $lang['lightbox_no_images'];
} else {
    set_download_token($user_info['lightbox_image_ids']);
    $thumbnails = "<table width=\"" . $config['image_table_width'] . "\" border=\"0\" cellpadding=\"" . $config['image_table_cellpadding'] . "\" cellspacing=\"" . $config['image_table_cellspacing'] . "\">\n";
    $count = 0;
    $bgcounter = 0;
    while ($image_row = $site_db->fetch_array($result)) {
        if (!$download_allowed && check_permission("auth_download", $image_row['cat_id'])) {
            $download_allowed = true;
        }
        if ($count == 0) {
            $row_bg_number = $bgcounter++ % 2 == 0 ? 1 : 2;
            $thumbnails .= "<tr class=\"imagerow" . $row_bg_number . "\">\n";
        }
        $thumbnails .= "<td width=\"" . $imgtable_width . "\" valign=\"top\">\n";
        show_image($image_row, "lightbox");
        $thumbnails .= $site_template->parse_template("thumbnail_bit");
        $thumbnails .= "\n</td>\n";
        $count++;
        if ($count == $config['image_cells']) {
            $thumbnails .= "</tr>\n";
            $count = 0;
        }
    }
    // end while
    if ($count > 0) {
        $leftover = $config['image_cells'] - $count;
        if ($leftover >= 1) {
            for ($i = 0; $i < $leftover; $i++) {
                $thumbnails .= "<td width=\"" . $imgtable_width . "\">\n&nbsp;\n</td>\n";
            }
示例#10
0
function show_forum($forum, $start, $sort_style, $user)
{
    $page_nav = page_links("forum_forum.php?id={$forum->id}&amp;sort={$sort_style}", $forum->threads, THREADS_PER_PAGE, $start);
    echo $page_nav;
    start_forum_table(array("", tra("Threads"), tra("Posts"), tra("Author"), tra("Views"), "<nobr>" . tra("Last post") . "</nobr>"));
    $sticky_first = !$user || !$user->prefs->ignore_sticky_posts;
    // Show hidden threads if logged in user is a moderator
    //
    $show_hidden = is_moderator($user, $forum);
    $threads = get_forum_threads($forum->id, $start, THREADS_PER_PAGE, $sort_style, $show_hidden, $sticky_first);
    if ($user) {
        $subs = BoincSubscription::enum("userid={$user->id}");
    }
    // Run through the list of threads, displaying each of them
    //
    $n = 0;
    $i = 0;
    foreach ($threads as $thread) {
        $owner = BoincUser::lookup_id($thread->owner);
        if (!$owner) {
            continue;
        }
        $unread = thread_is_unread($user, $thread);
        //if ($thread->status==1){
        // This is an answered helpdesk thread
        if ($user && is_subscribed($thread, $subs)) {
            echo '<tr class="row_hd' . $n . '">';
        } else {
            // Just a standard thread.
            echo '<tr class="row' . $n . '">';
        }
        echo "<td width=\"1%\" class=\"threadicon\"><nobr>";
        if ($thread->hidden) {
            show_image(IMAGE_HIDDEN, tra("This thread is hidden"), tra("hidden"));
        } else {
            if ($unread) {
                if ($thread->sticky) {
                    if ($thread->locked) {
                        show_image(NEW_IMAGE_STICKY_LOCKED, tra("This thread is sticky and locked, and you haven't read it yet"), tra("sticky/locked/unread"));
                    } else {
                        show_image(NEW_IMAGE_STICKY, tra("This thread is sticky and you haven't read it yet"), tra("sticky/unread"));
                    }
                } else {
                    if ($thread->locked) {
                        show_image(NEW_IMAGE_LOCKED, tra("You haven't read this thread yet, and it's locked"), tra("unread/locked"));
                    } else {
                        show_image(NEW_IMAGE, tra("You haven't read this thread yet"), tra("unread"));
                    }
                }
            } else {
                if ($thread->sticky) {
                    if ($thread->locked) {
                        show_image(IMAGE_STICKY_LOCKED, tra("This thread is sticky and locked"), tra("sticky/locked"));
                    } else {
                        show_image(IMAGE_STICKY, tra("This thread is sticky"), tra("sticky"));
                    }
                } else {
                    if ($thread->locked) {
                        show_image(IMAGE_LOCKED, tra("This thread is locked"), tra("locked"));
                    } else {
                        show_image(IMAGE_POST, tra("You read this thread"), tra("read"));
                    }
                }
            }
        }
        echo "</nobr></td>";
        $title = cleanup_title($thread->title);
        //$titlelength = 9999;
        //if (strlen($title) > $titlelength) {
        //    $title = substr($title, 0, $titlelength)."...";
        //}
        echo "<td class=\"threadline\"><a href=\"forum_thread.php?id={$thread->id}\"><b>{$title}</b></a><br></td>";
        $n = ($n + 1) % 2;
        echo '
            <td class="numbers">' . ($thread->replies + 1) . '</td>
            <td>' . user_links($owner, BADGE_HEIGHT_SMALL) . '</td>
            <td class="numbers">' . $thread->views . '</td>
            <td class="lastpost">' . time_diff_str($thread->timestamp, time()) . '</td>
            </tr>
        ';
        flush();
    }
    end_table();
    echo "<br>{$page_nav}";
    // show page links
}
示例#11
0
 function run()
 {
     $col = 0;
     if (empty($this->images) && !empty($this->request['search_image'])) {
         echo 'No images found.';
         $this->show_search_function();
     } elseif (!empty($this->textonly)) {
         echo '<h3>Images</h3>' . "\n";
         foreach ($this->images as $id => $image) {
             echo '<div class="imageChunk">';
             show_image($image, false, true, true, false, true);
             echo "</div>";
         }
         $this->show_search_function();
         $this->show_paging();
     } else {
         echo '<table>';
         foreach ($this->images as $id => $image) {
             if ($col == 0) {
                 echo "<tr>";
             }
             echo "<td align='left' valign='bottom'>";
             echo "<div class=\"imageChunk\">";
             show_image($image, false, true, true, false, false, false);
             echo "</div></td>\n";
             $col = ($col + 1) % $this->columns;
             if ($col == 0) {
                 echo "</tr>";
             }
         }
         while ($col != 0) {
             $col = ($col + 1) % $this->columns;
             echo '<td>&nbsp;</td>';
         }
         echo '</tr></table>';
         $this->show_search_function();
         $this->show_paging();
     }
 }
示例#12
0
     foreach ($additional_image_fields as $key => $val) {
         $additional_sql .= ", i." . $key;
     }
 }
 $sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits" . $additional_sql . ", c.cat_name" . get_user_table_field(", u.", "user_name") . "\n          FROM (" . IMAGES_TABLE . " i,  " . CATEGORIES_TABLE . " c)\n          LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = i.user_id)\n          WHERE i.image_active = 1\n          {$sql_where_query}\n          AND c.cat_id = i.cat_id {$cat_id_sql}\n          ORDER BY " . $config['image_order'] . " " . $config['image_sort'] . ", image_id " . $config['image_sort'] . "\n          LIMIT {$offset}, {$perpage}";
 $result = $site_db->query($sql);
 $thumbnails = "<table width=\"" . $config['image_table_width'] . "\" border=\"0\" cellpadding=\"" . $config['image_table_cellpadding'] . "\" cellspacing=\"" . $config['image_table_cellspacing'] . "\">\n";
 $count = 0;
 $bgcounter = 0;
 while ($image_row = $site_db->fetch_array($result)) {
     if ($count == 0) {
         $row_bg_number = $bgcounter++ % 2 == 0 ? 1 : 2;
         $thumbnails .= "<tr class=\"imagerow" . $row_bg_number . "\">\n";
     }
     $thumbnails .= "<td width=\"" . $imgtable_width . "\" valign=\"top\">\n";
     show_image($image_row, "search");
     $thumbnails .= $site_template->parse_template("thumbnail_bit");
     $thumbnails .= "\n</td>\n";
     $count++;
     if ($count == $config['image_cells']) {
         $thumbnails .= "</tr>\n";
         $count = 0;
     }
 }
 // end while
 if ($count > 0) {
     $leftover = $config['image_cells'] - $count;
     if ($leftover >= 1) {
         for ($i = 0; $i < $leftover; $i++) {
             $thumbnails .= "<td width=\"" . $imgtable_width . "\">\n&nbsp;\n</td>\n";
         }
示例#13
0
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits" . $additional_sql . ", c.cat_name" . get_user_table_field(", u.", "user_name") . get_user_table_field(", u.", "user_email") . "\n        FROM (" . IMAGES_TABLE . " i,  " . CATEGORIES_TABLE . " c)\n        LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = i.user_id)\n        WHERE i.image_id = {$image_id} AND i.image_active = 1 AND c.cat_id = i.cat_id";
$image_row = $site_db->query_firstrow($sql);
$cat_id = isset($image_row['cat_id']) ? $image_row['cat_id'] : 0;
$is_image_owner = $image_row['user_id'] > USER_AWAITING && $user_info['user_id'] == $image_row['user_id'] ? 1 : 0;
if (!check_permission("auth_viewcat", $cat_id) || !check_permission("auth_viewimage", $cat_id) || !$image_row) {
    redirect($url);
}
$random_cat_image = defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0 ? "" : get_random_image($cat_id);
$site_template->register_vars("random_cat_image", $random_cat_image);
unset($random_cat_image);
//-----------------------------------------------------
//--- Show Image --------------------------------------
//-----------------------------------------------------
$image_allow_comments = check_permission("auth_readcomment", $cat_id) ? $image_row['image_allow_comments'] : 0;
$image_name = format_text($image_row['image_name'], 2);
show_image($image_row, $mode, 0, 1);
//--- SEO variables -------------------------------
$meta_keywords = !empty($image_row['image_keywords']) ? strip_tags(implode(", ", explode(",", $image_row['image_keywords']))) : "";
$meta_description = !empty($image_row['image_description']) ? strip_tags($image_row['image_description']) . ". " : "";
$site_template->register_vars(array("detail_meta_description" => $meta_description, "detail_meta_keywords" => $meta_keywords, "prepend_head_title" => $image_name . " - "));
$in_mode = 0;
$sql = "";
if ($mode == "lightbox") {
    if (!empty($user_info['lightbox_image_ids'])) {
        $image_id_sql = str_replace(" ", ", ", trim($user_info['lightbox_image_ids']));
        $sql = "SELECT image_id, cat_id, image_name, image_media_file, image_thumb_file\n            FROM " . IMAGES_TABLE . "\n            WHERE image_active = 1 AND image_id IN ({$image_id_sql}) AND (cat_id NOT IN (" . get_auth_cat_sql("auth_viewimage", "NOTIN") . ", " . get_auth_cat_sql("auth_viewcat", "NOTIN") . "))\n            ORDER BY " . $config['image_order'] . " " . $config['image_sort'] . ", image_id " . $config['image_sort'];
        $in_mode = 1;
    }
} elseif ($mode == "search") {
    if (!isset($session_info['searchid']) || empty($session_info['searchid'])) {
        $session_info['search_id'] = $site_sess->get_session_var("search_id");
示例#14
0
文件: controller.php 项目: rturi/I244
$mainContentView = 'view/main_page.html';
if (isset($_GET['mode'])) {
    $mode = $_GET['mode'];
    switch ($mode) {
        case 'main_page':
            show_main_page();
            break;
        case 'gallery':
            show_gallery();
            break;
        case 'img_upload':
            show_img_upload();
            break;
        case 'login':
            show_login();
            break;
        case 'register':
            show_register();
            break;
        case 'image':
            show_image();
            break;
        default:
            show_error('404');
    }
} else {
    show_main_page();
}
//include 'view/head.html';
//include $mainContentView;
//include 'view/foot.html';
示例#15
0
    die(msg('error', $DLG['file_not_found'] . " <b>({$file})</b>"));
}
if (is_dir($path)) {
    die(msg('alert', $DLG['not_file'] . " <b>({$file})</b>"));
}
if (!validate_path($path)) {
    die(msg('error', $DLG['invalid_dir'] . " <b>({$dir}{$file})</b>"));
}
$info = swampy_pathinfo($path);
switch ($info['extension']) {
    case "jpeg":
    case "jpg":
    case "gif":
    case "png":
    case "bmp":
        die(show_image($dir . $file));
        break;
    case "txt":
    case "php":
    case "js":
        die(show_text($path));
        break;
    case "html":
    case "htm":
        die(show_html($dir . $file));
        break;
    default:
        die(msg('alert', $DLG['not_supported_format']));
        break;
}
function show_image($src)
示例#16
0
文件: ofc.php 项目: arribanz/live
function Edit_Page()
{
    //*******************************************************
    global $_, $filename, $filecontents, $raw_contents, $etypes, $itypes, $MAX_EDIT_SIZE, $MAX_VIEW_SIZE, $WYSIWYG_VALID;
    clearstatcache();
    //Determine if a text editable file type
    $filename_parts = explode(".", strtolower($filename));
    $ext = end($filename_parts);
    if (in_array($ext, $etypes)) {
        $text_editable = TRUE;
    } else {
        $text_editable = FALSE;
    }
    $too_large_to_edit = filesize($filename) > $MAX_EDIT_SIZE;
    $too_large_to_view = filesize($filename) > $MAX_VIEW_SIZE;
    //Don't load $WYSIWYG_PLUGIN if not needed
    if (!$text_editable || $too_large_to_edit) {
        $WYSIWYG_VALID = 0;
    }
    if ($text_editable && !$too_large_to_view) {
        $raw_contents = file_get_contents($filename);
        $file_ENC = mb_detect_encoding($raw_contents);
        //ASCII, UTF-8, etc...
    } else {
        $file_ENC = "";
        $raw_contents = "";
    }
    if ($too_large_to_edit) {
        $header2 = hsc($_['edit_h2_1']);
    } else {
        $header2 = hsc($_['edit_h2_2']);
    }
    $too_large_to_edit_message = '<b>' . hsc($_['too_large_to_edit_01']) . ' ' . number_format($MAX_EDIT_SIZE) . ' ' . hsc($_['bytes']) . '</b><br>' . hsc($_['too_large_to_edit_02']) . '<br>' . hsc($_['too_large_to_edit_03']) . '<br>' . hsc($_['too_large_to_edit_04']);
    $too_large_to_view_message = '<b>' . hsc($_['too_large_to_view_01']) . ' ' . number_format($MAX_VIEW_SIZE) . ' ' . hsc($_['bytes']) . '</b><br>' . hsc($_['too_large_to_view_02']) . '<br>' . hsc($_['too_large_to_view_03']) . '<br>';
    //.hsc($_['too_large_to_view_04']);
    //Preserves vertical spacing when message is closed, so edit area doesn't jump as much.
    echo '<style>#message_box { min-height: 1.88em; }</style>';
    echo '<h2 id="edit_header">' . $header2 . ' ';
    echo '<a class="h2_filename" href="/' . URLencode_path($filename) . '" target="_blank" title="' . $_['Open_View'] . '">';
    echo hte(basename($filename)) . '</a>';
    echo '</h2>' . PHP_EOL;
    Edit_Page_form($ext, $text_editable, $too_large_to_edit, $too_large_to_edit_message, $file_ENC);
    if (in_array($ext, $itypes)) {
        show_image();
    }
    echo '<div class=clear></div>';
    if ($text_editable && $too_large_to_view) {
        echo '<p class="edit_disabled">' . $too_large_to_view_message . '</p>';
    } elseif ($text_editable && $too_large_to_edit) {
        $filecontents = hsc(file_get_contents($filename), ENT_COMPAT, 'UTF-8');
        echo '<pre class="edit_disabled view_file">' . $filecontents . '</pre>';
    }
}
示例#17
0
        $image = resize_image($image, $h, $w, $t, $a, $s, $c, $il);
    }
    $output_formats = array('png' => 'image/png', 'jpg' => 'image/jpeg', 'gif' => 'image/gif');
    if (isset($_GET['output']) && isset($output_formats[$_GET['output']])) {
        $img_data['mime'] = $output_formats[$_GET['output']];
    }
    header('Expires: ' . gmdate("D, d M Y H:i:s", time() + 2678400) . ' GMT');
    //31 days
    header('Cache-Control: max-age=2678400');
    //31 days
    if (isset($_GET['encoding']) && $_GET['encoding'] == 'base64') {
        header('Content-type: text/plain');
    } else {
        header('Content-type: ' . $img_data['mime']);
    }
    show_image($image, $q);
    exit;
} else {
    ?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
    <title>Image cache &amp; resize proxy</title>
    <link rel="icon" type="image/x-icon" href="favicon.ico"/>
    <link href="//static.weserv.nl/images.css" type="text/css" rel="stylesheet"/>
    <!--[if lte IE 9]><script src="//static.weserv.nl/html5shiv-printshiv.min.js" type="text/javascript"></script><![endif]-->
    <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js" type="text/javascript"></script>
    <script src="//static.weserv.nl/bootstrap.min.js" type="text/javascript"></script>
</head>
?>
" />
  	<style>
  		body { font-family: Helvetica, Arial, sans-serif; color: #333; }
  		.item { margin: 20px; width: 600px; padding-bottom: 20px; border-bottom: 1px solid #ccc }
  		.caption { margin-bottom: 10px; font-weight: bold; color: #0b63b6; }
  		.public_id { margin-top: 5px; font-size: 12px; color: #666; }
  		h1 { color: #0e2953; }
  		h2, h3 { color: #0e5e01; }
  		.link { margin-top: 5px; }
  		.link a { font-size: 12px; color: #666; }
  	</style>
  </head>
  <body>
    <?php 
echo "<h1>Cloudinary - Basic PHP Sample";
echo "<h2>Uploading ... </h2>";
do_uploads();
echo "<h3>... Done uploading!</h3>";
?>
    
    <?php 
show_image($files["unnamed_local"], array("width" => 200, "height" => 150, "crop" => "fill"), "Local file, Fill 200x150");
show_image($files["named_local"], array("width" => 200, "height" => 150, "crop" => "fit"), "Local file, custom public ID, Fit into 200x150");
show_image($files["eager"], $eager_params, "Local file, Eager trasnformation of scaling to 200x150");
show_image($files["remote"], array("width" => 200, "height" => 150, "crop" => "thumb", "gravity" => "faces"), "Uploaded remote image, Face detection based 200x150 thumbnail");
show_image($files["remote_trans"], array("width" => 200, "height" => 150, "crop" => "fill", "gravity" => "face", "radius" => 10, "effect" => "sepia"), "Uploaded remote image, Fill 200x150, round corners, apply the sepia effect");
?>
  </body>
</html>
示例#19
0
		function get_primary_image( $item )
		{
			if(empty($this->parent->textonly))
			{
				$item->set_env('site_id',$this->parent->site_id);
				$images = $item->get_left_relationship( relationship_id_of('av_to_primary_image') );
				if(!empty($images))
				{
					$image = current($images);
					if($this->params['thumbnail_width'] != 0 or $this->params['thumbnail_height'] != 0)
					{
						$rsi = new reasonSizedImage();
						if(!empty($rsi))
						{
							$rsi->set_id($image->id());
							if($this->params['thumbnail_width'] != 0)
							{
								$rsi->set_width($this->params['thumbnail_width']);
							}
							if($this->params['thumbnail_height'] != 0)
							{
								$rsi->set_height($this->params['thumbnail_height']);
							}
							if($this->params['thumbnail_crop'] != '')
							{
								$rsi->set_crop_style($this->params['thumbnail_crop']);
							}
							$image = $rsi;
						}
					}
					
					$die_without_thumbnail = true;
					$show_popup_link = false;
					$show_description = false;
					$additional_text = '';
					if(empty($this->request[ $this->query_string_frag.'_id' ]) || $this->request[ $this->query_string_frag.'_id' ] != $item->id() )
					{
						$link = $this->construct_link($item);
					}
					else
					{
						$link = '';
					}
					
					show_image( $image, $die_without_thumbnail, $show_popup_link, $show_description, $additional_text, $this->parent->textonly, false, $link );
				}
			}
		}
示例#20
0
 $result = $site_db->query($sql);
 $num_rows = $site_db->get_numrows($result);
 if (!$num_rows) {
     $thumbnails = "";
     $msg = $lang['no_images'];
 } else {
     $thumbnails = "<table width=\"" . $config['image_table_width'] . "\" border=\"0\" cellpadding=\"" . $config['image_table_cellpadding'] . "\" cellspacing=\"" . $config['image_table_cellspacing'] . "\">\n";
     $count = 0;
     $bgcounter = 0;
     while ($image_row = $site_db->fetch_array($result)) {
         if ($count == 0) {
             $row_bg_number = $bgcounter++ % 2 == 0 ? 1 : 2;
             $thumbnails .= "<tr class=\"imagerow" . $row_bg_number . "\">\n";
         }
         $thumbnails .= "<td width=\"" . $imgtable_width . "\" valign=\"top\">\n";
         show_image($image_row);
         $thumbnails .= $site_template->parse_template("thumbnail_bit");
         $thumbnails .= "\n</td>\n";
         $count++;
         if ($count == $config['image_cells']) {
             $thumbnails .= "</tr>\n";
             $count = 0;
         }
     }
     // end while
     if ($count > 0) {
         $leftover = $config['image_cells'] - $count;
         if ($leftover > 0) {
             for ($i = 0; $i < $leftover; $i++) {
                 $thumbnails .= "<td width=\"" . $imgtable_width . "\">\n&nbsp;\n</td>\n";
             }
示例#21
0
文件: pm.php 项目: CalvinZhu/boinc
function show_block_link($userid)
{
    echo " <a href=\"pm.php?action=block&amp;id={$userid}\">";
    show_image(REPORT_POST_IMAGE, tra("Block messages from this user"), tra("Block user"), REPORT_POST_IMAGE_HEIGHT);
    echo "</a>";
}
    show_template_edit_form($templateid, $itemid, $hidden, $caneditsite);
    if ($itemid != 0) {
        $hidden .= '<input type="hidden" name="itemid" value="' . $itemid . '" />';
        $canedit = false;
        if ($caneditsite) {
            $canedit = true;
        } else {
            $template = get_record('assignment_uploadpdf_tmpl', 'id', $templateid);
            if ($template && $template->course > 0) {
                $canedit = true;
            }
        }
        show_item_form($itemid, $hidden, $canedit);
    }
}
show_image($imagename, $templateid, $courseid, $hidden, $itemid);
print_footer($course);
function show_select_template($courseid, $hidden, $templateid = 0)
{
    global $CFG;
    echo '<form name="selecttemplate" enctype="multipart/form-data" method="post" action="edittemplates.php">';
    echo '<fieldset>';
    echo $hidden;
    echo '<label for="templateid">' . get_string('choosetemplate', 'assignment_uploadpdf') . ': </label>';
    echo '<select name="templateid" onchange="document.selecttemplate.submit();">';
    if ($templateid == -1) {
        echo '<option value="-1" selected="selected">' . get_string('newtemplate', 'assignment_uploadpdf') . '</option>';
    } else {
        echo '<option value="-1">' . get_string('newtemplate', 'assignment_uploadpdf') . '</option>';
    }
    $templates_data = get_records_sql("SELECT id, name FROM {$CFG->prefix}assignment_uploadpdf_tmpl WHERE course = 0 OR course = {$courseid}");
示例#23
0
function Edit_Page()
{
    //********************************************************
    global $_, $filename, $filename_OS, $FILECONTENTS, $etypes, $itypes, $EX, $message, $page, $MAX_EDIT_SIZE, $MAX_VIEW_SIZE, $WYSIWYG_VALID, $IS_OFCMS;
    $filename_parts = explode(".", mb_strtolower($filename));
    $ext = end($filename_parts);
    //Determine if a text editable file type
    if (in_array($ext, $etypes)) {
        $text_editable = TRUE;
    } else {
        $text_editable = FALSE;
    }
    $too_large_to_edit = filesize($filename_OS) > $MAX_EDIT_SIZE;
    $too_large_to_view = filesize($filename_OS) > $MAX_VIEW_SIZE;
    //Don't load $WYSIWYG_PLUGIN if not needed
    if (!$text_editable || $too_large_to_edit) {
        $WYSIWYG_VALID = 0;
    }
    //Get file contents
    if ($text_editable && !$too_large_to_view || $IS_OFCMS) {
        $raw_contents = file_get_contents($filename_OS);
        $file_ENC = mb_detect_encoding($raw_contents);
        //ASCII, UTF-8, ISO-8859-1, etc...
        if ($file_ENC != 'UTF-8') {
            $raw_contents = mb_convert_encoding($raw_contents, 'UTF-8', $file_ENC);
        }
    } else {
        $file_ENC = "";
        $raw_contents = "";
    }
    if (PHP_VERSION_ID < 50400) {
        $FILECONTENTS = hsc($raw_contents);
    } else {
        $FILECONTENTS = htmlspecialchars($raw_contents, ENT_SUBSTITUTE | ENT_QUOTES, 'UTF-8');
    }
    if ($too_large_to_view || !$text_editable) {
        $header2 = "";
    } elseif ($text_editable && !$too_large_to_edit && !$IS_OFCMS) {
        $header2 = hsc($_['edit_h2_2']);
    } else {
        $header2 = hsc($_['edit_h2_1']);
    }
    echo '<h2 id="edit_header">' . $header2 . ' ';
    echo '<a class="h2_filename" href="/' . URLencode_path($filename) . '" target="_blank" title="' . hsc($_['Open_View']) . '">';
    echo hsc(basename($filename)) . '</a>';
    echo '</h2>' . "\n";
    Edit_Page_form($ext, $text_editable, $too_large_to_edit, $too_large_to_view, $file_ENC);
    if (in_array($ext, $itypes)) {
        show_image();
    }
    //If image, show below the [Rename/Move] [Copy] [Delete] buttons
    echo '<div class=clear></div>';
    //If viewing OneFileCMS itself, show Edit Disabled message.
    if ($IS_OFCMS && $page == "edit") {
        $message .= '<style>.message_box_contents {background: red;}</style>';
        $message .= '<style>#message_box          {color: white;}   </style>';
        $message .= '<b>' . $EX . hsc($_['edit_caution_02']) . ' &nbsp; ' . $_['edit_txt_00'] . '</b><br>';
    }
}
示例#24
0
            color: #0e5e01;
        }

        .link {
            margin-top: 5px;
        }

        .link a {
            font-size: 12px;
            color: #666;
        }
    </style>
</head>
<body>
    <h1>Cloudinary - Basic PHP Sample</h1>
    <h2>Uploading ... </h2>
    <?php 
do_uploads();
?>
    <h3>... Done uploading!</h3>

<?php 
show_image($files['unnamed_local'], array('width' => 200, 'height' => 150, 'crop' => 'fill'), 'Local file, Fill 200x150');
show_image($files['named_local'], array('width' => 200, 'height' => 150, 'crop' => 'fit'), 'Local file, custom public ID, Fit into 200x150');
show_image($files['eager'], $eager_params, 'Local file, Eager trasnformation of scaling to 200x150');
show_image($files['remote'], array('width' => 200, 'height' => 150, 'crop' => 'thumb', 'gravity' => 'faces'), 'Uploaded remote image, Face detection based 200x150 thumbnail');
show_image($files['remote_trans'], array('width' => 200, 'height' => 150, 'crop' => 'fill', 'gravity' => 'face', 'radius' => 10, 'effect' => 'sepia'), 'Uploaded remote image, Fill 200x150, round corners, apply the sepia effect');
?>
</body>
</html>
示例#25
0
					
						imagefilter($canvas, $imageFilters[$filterSettings[0]][0], $filterSettings[1], $filterSettings[2], $filterSettings[3]);
						break;
					
					default:
					
						imagefilter($canvas, $imageFilters[$filterSettings[0]][0]);
						break;
						
				}
			}
		}
	}
	
	// output image to browser based on mime type
	show_image($mime_type, $canvas, $cache_dir);
	
	// remove image from memory
	imagedestroy($canvas);
	
} else {

	if(strlen($src)) {
		displayError("image " . $src . " not found");
	} else {
		displayError("no source specified");
	}
	
}

/**
示例#26
0
function get_random_image($cat_id = 0, $show_link = 1, $return_file = 0)
{
    global $site_template, $random_image_cache;
    if (!isset($random_image_cache)) {
        $random_image_cache = get_random_image_cache();
    }
    if ($cat_id && SHOW_RANDOM_CAT_IMAGE) {
        $template = 'random_cat_image';
        $category_id = $cat_id;
    } else {
        $template = 'random_image';
        if (SHOW_RANDOM_CAT_IMAGE) {
            srand((double) microtime() * 1000000);
            $category_id = array_rand($random_image_cache);
        } else {
            $category_id = 0;
        }
    }
    if (!empty($random_image_cache[$category_id])) {
        if (!$return_file) {
            show_image($random_image_cache[$category_id], "", $show_link);
            $random_image = $site_template->parse_template($template);
            return $random_image;
        } else {
            return get_file_path($random_image_cache[$category_id]['image_thumb_file'], "thumb", $category_id, 0, 1);
        }
    }
}
示例#27
0
function show_forum($forum, $start, $sort_style, $user)
{
    $gotoStr = "";
    $nav = show_page_nav($forum, $start);
    if ($nav) {
        $gotoStr = "<div align=\"right\">{$nav}</div><br />";
    }
    echo $gotoStr;
    // Display the navbar
    start_forum_table(array("", tra("Threads"), tra("Posts"), tra("Author"), tra("Views"), "<nobr>" . tra("Last post") . "</nobr>"));
    $sticky_first = !$user || !$user->prefs->ignore_sticky_posts;
    // Show hidden threads if logged in user is a moderator
    //
    $show_hidden = is_moderator($user, $forum);
    $threads = get_forum_threads($forum->id, $start, THREADS_PER_PAGE, $sort_style, $show_hidden, $sticky_first);
    if ($user) {
        $subs = BoincSubscription::enum("userid={$user->id}");
    }
    // Run through the list of threads, displaying each of them
    $n = 0;
    $i = 0;
    foreach ($threads as $thread) {
        $owner = BoincUser::lookup_id($thread->owner);
        $unread = thread_is_unread($user, $thread);
        //if ($thread->status==1){
        // This is an answered helpdesk thread
        if ($user && is_subscribed($thread, $subs)) {
            echo '<tr class="row_hd' . $n . '">';
        } else {
            echo '<tr class="row' . $n . '">';
        }
        echo '<td width="1%"><nobr>';
        if ($user && $thread->rating() > $user->prefs->high_rating_threshold) {
            show_image(EMPHASIZE_IMAGE, "This message has a high average rating", "Highly rated");
        }
        if ($user && $thread->rating() < $user->prefs->low_rating_threshold) {
            show_image(FILTER_IMAGE, "This message has a low average rating", "Low rated");
        }
        if ($thread->hidden) {
            echo "[hidden]";
        }
        if ($unread) {
            if ($thread->sticky) {
                if ($thread->locked) {
                    show_image(NEW_IMAGE_STICKY_LOCKED, "This thread is sticky and locked, and you haven't read it yet", "sticky/locked/unread");
                } else {
                    show_image(NEW_IMAGE_STICKY, "This thread is sticky and you haven't read it yet", "sticky/unread");
                }
            } else {
                if ($thread->locked) {
                    show_image(NEW_IMAGE_LOCKED, "You haven't read this thread yet, and it's locked", "unread/locked");
                } else {
                    show_image(NEW_IMAGE, "You haven't read this thread yet", "unread");
                }
            }
        } else {
            if ($thread->sticky) {
                if ($thread->locked) {
                    show_image(IMAGE_STICKY_LOCKED, "This thread is sticky and locked", "sticky/locked");
                } else {
                    show_image(IMAGE_STICKY, "This thread is sticky", "sticky");
                }
            } else {
                if ($thread->locked) {
                    show_image(IMAGE_LOCKED, "This thread is locked", "locked");
                }
            }
        }
        echo "</nobr></td>";
        $titlelength = 48;
        $title = $thread->title;
        if (strlen($title) > $titlelength) {
            $title = substr($title, 0, $titlelength) . "...";
        }
        $title = cleanup_title($title);
        echo '<td class="threadline">
			<a href="forum_thread.php?id=' . $thread->id . '"><strong>' . $title . '</strong></a>
			<br /></td>';
        $n = ($n + 1) % 2;
        echo '<td class="numbers leftborder">' . ($thread->replies + 1) . '</td>
			<td class="author leftborder">' . user_links($owner) . '</td>
			<td class="numbers leftborder">' . $thread->views . '</td>
			<td class="lastpost leftborder">' . time_diff_str($thread->timestamp, time()) . '</td>
			</tr>';
        flush();
    }
    end_table();
    echo "<br />{$gotoStr}";
    // show page links
}
<?php

require "settings.php";
$OUTPUT = show_image($_GET);
require "template.php";
function show_image($_POST)
{
    extract($_POST);
    if (!isset($picid)) {
        return "";
    }
    db_connect();
    $get_img = "SELECT type,ident_id FROM display_images WHERE id = '{$picid}' LIMIT 1";
    $run_img = db_exec($get_img) or errDie("Unable to get image information.");
    if (pg_numrows($run_img) < 1) {
        #image not found ??
        $previous = "";
        $next = "";
    } else {
        $arr = pg_fetch_array($run_img);
        $previous = "";
        $next = "";
        #check for any additional images for this member
        #get prev button
        $get_other = "SELECT id FROM display_images WHERE type = '{$arr['type']}' AND ident_id = '{$arr['ident_id']}' AND id < '{$picid}' ORDER BY id desc LIMIT 1";
        $run_other = db_exec($get_other) or errDie("Unable to get images information.");
        if (pg_numrows($run_other) > 0) {
            $previous = "<input type='button' onCLick=\"document.location='view_image.php?picid=" . pg_fetch_result($run_other, 0, 0) . "'\" value='Previous'>";
        }
        $get_other = "SELECT id FROM display_images WHERE type = '{$arr['type']}' AND ident_id = '{$arr['ident_id']}' AND id > '{$picid}' LIMIT 1";
        $run_other = db_exec($get_other) or errDie("Unable to get images information.");
示例#29
0
                        break;
                    default:
                        imagefilter($canvas, $imageFilters[$filterSettings[0]][0]);
                        break;
                }
            }
        }
    }
    if ($sharpen > 0 && function_exists('imageconvolution')) {
        $sharpenMatrix = array(array(-1, -1, -1), array(-1, 16, -1), array(-1, -1, -1));
        $divisor = 8;
        $offset = 0;
        imageconvolution($canvas, $sharpenMatrix, $divisor, $offset);
    }
    // output image to browser based on mime type
    show_image($mime_type, $canvas);
    // remove image from memory
    imagedestroy($canvas);
} else {
    if (strlen($src)) {
        displayError('image ' . $src . ' not found');
    } else {
        displayError('no source specified');
    }
}
/**
 *
 */
function show_image($mime_type, $image_resized)
{
    global $quality;
示例#30
0
文件: proxy.php 项目: rdmpage/biostor
    default:
        $url .= ',500,500';
        break;
}
$filename = $PageID . '-' . $image_size;
$image = create_image($url);
$q = 85;
$output_formats = array('png' => 'image/png', 'jpg' => 'image/jpeg', 'gif' => 'image/gif');
if (isset($_GET['output']) && isset($output_formats[$_GET['output']])) {
    $img_data['mime'] = $output_formats[$_GET['output']];
}
header('Expires: ' . gmdate("D, d M Y H:i:s", time() + 2678400) . ' GMT');
//31 days
header('Cache-Control: max-age=2678400');
//31 days
if (isset($_GET['encoding']) && $_GET['encoding'] == 'base64') {
    header('Content-Type: text/plain');
    ob_start('custom_base64');
} else {
    header('Content-Type: ' . $img_data['mime']);
    ob_start();
}
show_image($image, $q, $filename);
if (!isset($_GET['encoding']) || $_GET['encoding'] != 'base64') {
    header('Content-Length: ' . ob_get_length());
}
ob_end_flush();
?>