Ejemplo n.º 1
0
    function slideShow_anything()
    {
        echo <<<HTML
<div id="feature_box" class="anything">
\t<div class="inner">
\t\t<div id="anything_slider_wrap">
\t\t\t<ul id="anything_slider">
HTML;
        $images = $this->slideShow_getPosts('-1', 'full');
        $height = theme_get_option('slideshow', 'anything_height');
        foreach ($images as $image) {
            $stop = get_post_meta($image['id'], '_anything_stop', true);
            if ($stop === '1') {
                echo "\n<li class='panel stoped'>\n";
            } else {
                echo "\n<li class='panel'>\n";
            }
            switch (get_post_meta($image['id'], '_anything_type', true)) {
                case 'sidebar':
                    echo '<div class="anything_sidebar_' . get_post_meta($image['id'], '_sidebar_position', true) . '">';
                    echo '<div class="anything_sidebar_content">';
                    $page_data = get_page($image['id']);
                    $content = $page_data->post_content;
                    echo apply_filters('the_content', stripslashes($content));
                    echo '</div>';
                    echo '<div class="anything_sidebar_image">';
                    if ($image['link'] != '') {
                        echo '<a href="' . $image['link'] . '"><img src="' . THEME_INCLUDES . '/timthumb.php?src=' . get_image_src($image['src']) . '&amp;h=' . $height . '&amp;w=660&amp;zc=1" alt="" /></a>';
                    } else {
                        echo '<img src="' . THEME_INCLUDES . '/timthumb.php?src=' . get_image_src($image['src']) . '&amp;h=' . $height . '&amp;w=660&amp;zc=1" alt="" />';
                    }
                    echo '</div>';
                    echo '</div>';
                    break;
                case 'html':
                    $page_data = get_page($image['id']);
                    $content = $page_data->post_content;
                    echo apply_filters('the_content', stripslashes($content));
                    break;
                case 'image':
                default:
                    $caption_position = get_post_meta($image['id'], '_image_caption_position', true);
                    if ($caption_position != '' && $caption_position != 'disable') {
                        echo '<div class="anything_caption caption_' . $caption_position . '">';
                        echo '<h3>' . $image['title'] . '</h3>';
                        if ($image['desc']) {
                            echo '<p>' . $image['desc'] . '</p>';
                        }
                        echo '</div>';
                    }
                    if ($image['link'] != '') {
                        echo '<a href="' . $image['link'] . '"><img src="' . THEME_INCLUDES . '/timthumb.php?src=' . get_image_src($image['src']) . '&amp;h=' . $height . '&amp;w=960&amp;zc=1" alt="" /></a>';
                    } else {
                        echo '<img src="' . THEME_INCLUDES . '/timthumb.php?src=' . get_image_src($image['src']) . '&amp;h=' . $height . '&amp;w=960&amp;zc=1" alt="" />';
                    }
                    break;
            }
            echo "\n</li>\n";
        }
        echo <<<HTML
\t\t\t</ul>
\t\t</div>
\t</div>
</div>
HTML;
        $options = array('height' => theme_get_option('slideshow', 'anything_height'), 'buildArrows' => theme_get_option('slideshow', 'anything_buildArrows'), 'toggleArrows' => theme_get_option('slideshow', 'anything_toggleArrows'), 'buildNavigation' => theme_get_option('slideshow', 'anything_buildNavigation'), 'toggleControls' => theme_get_option('slideshow', 'anything_toggleControls'), 'autoPlay' => theme_get_option('slideshow', 'anything_autoPlay'), 'pauseOnHover' => theme_get_option('slideshow', 'anything_pauseOnHover'), 'resumeOnVideoEnd' => theme_get_option('slideshow', 'anything_resumeOnVideoEnd'), 'stopAtEnd' => theme_get_option('slideshow', 'anything_stopAtEnd'), 'playRtl' => theme_get_option('slideshow', 'anything_playRtl'), 'delay' => theme_get_option('slideshow', 'anything_delay'), 'animationTime' => theme_get_option('slideshow', 'anything_animationTime'), 'easing' => theme_get_option('slideshow', 'anything_easing'));
        echo "\n<script type=\"text/javascript\">\n";
        echo "var slideShow = []; \n";
        foreach ($options as $key => $value) {
            if (is_bool($value)) {
                $value = $value ? "true" : "false";
            } elseif ($value != "true" && $value != "false") {
                $value = "'" . $value . "'";
            }
            echo "slideShow['" . $key . "'] = " . $value . "; \n";
        }
        echo "</script>\n";
    }
Ejemplo n.º 2
0
if ($navigationpage == "reviewdetails.php") {
    $navigation = build_navigation(array(array('name' => $blended->name, 'link' => "../../mod/blended/view.php?a={$blended->id}", 'type' => 'misc'), array('name' => $strrevisionpage, 'link' => "../../mod/blended/revision.php?a={$blended->id}", 'type' => 'misc'), array('name' => $strreviewdetailspage, 'link' => "../../mod/blended/reviewdetails.php?a={$blended->id}", 'type' => 'misc'), array('name' => $strimagepage, 'link' => null, 'type' => 'misc')));
    print_header("{$course->shortname}: {$blended->name}: {$strreviewdetailspage}", "{$course->shortname}", $navigation, "", "", true, update_module_button($cm->id, $course->id, $blended->name, $strreviewdetailspage), navmenu($course, $cm));
}
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)
Ejemplo n.º 3
0
function send_thumb($image, $compression, $sizex, $sizey, $generateOnly = false)
{
    global $bg_color_preview_R, $bg_color_preview_G, $bg_color_preview_B;
    set_error_handler("on_error_no_output");
    ini_set("gd.jpeg_ignore_warning", 1);
    // since php 5.1.3 this leads that corrupt jpgs are read much better!
    set_error_handler("on_error");
    $srcx = 0;
    $srcy = 0;
    $dimx = $sizex;
    $dimy = $sizey;
    $usethumbs = false;
    if (file_exists(dirname(__FILE__) . "/thumbs") && is_writable(dirname(__FILE__) . "/thumbs")) {
        // is a caching dir available and writeable?
        $cachename = dirname(__FILE__) . "/thumbs/" . sha1($image . $sizex) . ".jpg";
        $usethumbs = true;
    }
    if ($usethumbs && file_exists($cachename)) {
        // we return the jpg!
        header("Content-type: image/jpg");
        header("Content-Length: " . filesize($cachename));
        header("Pragma: no-cache");
        header("Expires: 0");
        $fp = fopen($cachename, "rb");
        while ($content = fread($fp, 8192)) {
            print $content;
        }
        fclose($fp);
        return true;
    } else {
        if (file_exists($image)) {
            $oldsize = getimagesize($image);
            // for broken images we try to read the exif data!
            if ($oldsize[0] == 0) {
                $oldsize = get_exif_size($image, $image);
            }
            $oldsizex = $oldsize[0];
            $oldsizey = $oldsize[1];
            if ($oldsizex < $sizex && $oldsizey < $sizey) {
                $sizex = $oldsizex;
                $sizey = $oldsizey;
            }
            $height = $sizey;
            $width = $height / $oldsizey * $oldsizex;
            if ($width > $sizex) {
                $width = $sizex;
                $height = $width / $oldsizex * $oldsizey;
            }
            if (isMemoryOk($oldsize, "")) {
                $src = get_image_src($image, $oldsize[2]);
                if (!$src) {
                    // error in image!
                    if ($sizex < 100) {
                        // we return an empty white one ;).
                        $src = ImageCreateTrueColor($oldsizex, $oldsizey);
                        $back = imagecolorallocate($src, 255, 255, 255);
                        imagefilledrectangle($src, 0, 0, $oldsizex, $oldsizex, $back);
                    }
                    debug($image . " is not a valid image - please check the file.");
                    return false;
                }
                // $dst = ImageCreateTrueColor($width, $height);
                $dst = ImageCreateTrueColor($dimx, $dimy);
                if ($dimx < 100) {
                    // white bg for small preview
                    $back = imagecolorallocate($dst, $bg_color_preview_R, $bg_color_preview_G, $bg_color_preview_B);
                } else {
                    // gray bg for big preview
                    $back = imagecolorallocate($dst, 245, 245, 245);
                }
                imagefilledrectangle($dst, 0, 0, $dimx, $dimy, $back);
                if ($dimx > 100) {
                    // border
                    imagerectangle($dst, 0, 0, $dimx - 1, $dimy - 1, imagecolorallocate($dst, 160, 160, 160));
                }
                $offsetx = 0;
                $offsetx_b = 0;
                if ($dimx > $width) {
                    // we have to center!
                    $offsetx = floor(($dimx - $width) / 2);
                } else {
                    if ($dimx > 100) {
                        $offsetx = 4;
                        $offsetx_b = 8;
                    }
                }
                $offsety = 0;
                $offsety_b = 0;
                if ($dimy > $height) {
                    // we have to center!
                    $offsety = floor(($dimy - $height) / 2);
                } else {
                    if ($dimx > 100) {
                        $offsety = 4;
                        $offsety_b = 8;
                    }
                }
                $trans = imagecolortransparent($src);
                imagecolorset($src, $trans, 255, 255, 255);
                imagecolortransparent($src, imagecolorallocate($src, 0, 0, 0));
                imagecopyresampled($dst, $src, $offsetx, $offsety, $srcx, $srcy, $width - $offsetx_b, $height - $offsety_b, $oldsizex, $oldsizey);
                header("Content-type: image/jpg");
                if ($usethumbs) {
                    // we save the thumb
                    imagejpeg($dst, $cachename, $compression);
                }
                if (!$generateOnly) {
                    header("Pragma: no-cache");
                    header("Expires: 0");
                    ob_start();
                    if (imagejpeg($dst, "", $compression)) {
                        $buffer = ob_get_contents();
                        header("Content-Length: " . strlen($buffer));
                        ob_end_clean();
                        echo $buffer;
                        @imagedestroy($dst);
                        return true;
                    } else {
                        ob_end_flush();
                        debug('cannot save: ' . $image);
                        @imagedestroy($src);
                    }
                }
            }
        }
    }
    return false;
}
Ejemplo n.º 4
0
<?php

require 'header.php';
$id = $_GET['id'];
$row = get_news_by_id($id);
$path = get_image_src($id, 'update');
copy_image($path);
?>

<div id="updatenews"style="margin-left:150px;">
     <div style="float:left">
        <table>
            <tr><td class="text"id="title_text"><h4 >Վերնագիր</h4></td></tr>
            <tr><td><textarea rows="4" cols="10" name="title" id="newstitle"><?php 
echo $row['title'];
?>
</textarea></td></tr>
            <tr><td class="text" id="content_text"><h4 >Բովանդակ.</h4></td></tr>
            <tr><td><textarea rows="10" cols="10" name="content" id="content"><?php 
echo $row['content'];
?>
</textarea></td></tr>
            <tr><td class="text" id="video_title"><h4>Վիդեո</h4></td></tr>
            <tr><td><input type="text" name="video" id="video" value='<?php 
echo $row['video'];
?>
' /></td></tr>
            <tr><td>Նշել որպես գլխավոր<input id="heading"type="checkbox"style="width:50px;"<?php 
if ($row['heading']) {
    echo 'checked';
}
Ejemplo n.º 5
0
$conn = connect();
$query = "select* from news where lang='{$language}' order by inserttime desc limit {$page},10";
$res = mysqli_query($conn, $query);
while ($row = mysqli_fetch_assoc($res)) {
    $id = $row['id'];
    $content = $row['content'];
    $length = strlen($content);
    $pos = 0;
    if ($length > 300) {
        $pos = strpos($content, " ", 300);
    }
    if ($pos) {
        $content = substr($content, 0, $pos);
    }
    $content .= "...";
    $path = get_image_src($id);
    //list($width, $height, $type, $attr) = getimagesize("img/flag.jpg");
    ?>
      <div style="border-bottom:1px solid">
        <a href=<?php 
    echo "one_news.php?id={$id}";
    ?>
>
        <h3><?php 
    echo $row['title'];
    ?>
</h3>
        <br/>
        <?php 
    if ($path) {
        echo '<img style="float:left;width:115px;height:115px; margin-right: 10px;"src=' . $path . '></img>';
Ejemplo n.º 6
0
function theme_shortcode_portfolio($atts, $content = null, $code)
{
    global $wp_filter;
    $the_content_filter_backup = $wp_filter['the_content'];
    extract(shortcode_atts(array('column' => 4, 'cat' => '', 'max' => 12, 'nopaging' => 'false', 'sortable' => 'false'), $atts));
    switch ($column) {
        case 1:
            $column_class = 'one_column';
            $size = array(600, (int) theme_get_option('portfolio', '1_column_height'));
            break;
        case 2:
            $column_class = 'two_columns';
            $size = array(450, (int) theme_get_option('portfolio', '2_columns_height'));
            break;
        case 3:
            $column_class = 'three_columns';
            $size = array(292, (int) theme_get_option('portfolio', '3_columns_height'));
            break;
        case 4:
        default:
            $column_class = 'four_columns';
            $size = array(217, (int) theme_get_option('portfolio', '4_columns_height'));
    }
    $group = 'portfolio_' . rand(1, 1000);
    //for lightbox group
    if ($sortable != 'false') {
        //print scripts for sortable
        wp_print_scripts('jquery-quicksand');
        wp_print_scripts('jquery-easing');
        $output = '<section class="portfolios sortable">';
        $output .= '<header class="sort_by_cat">';
        $output .= '<span>' . __('Show:', 'striking_front') . '</span>';
        $output .= '<a data-value="all" href="#">' . __('All', 'striking_front') . '</a>';
        $terms = array();
        if ($cat != '') {
            foreach (explode(',', $cat) as $term_slug) {
                $terms[] = get_term_by('slug', $term_slug, 'portfolio_category');
            }
        } else {
            $terms = get_terms('portfolio_category', 'hide_empty=1');
        }
        foreach ($terms as $term) {
            $output .= '<a data-value="' . $term->slug . '" href="#">' . $term->name . '</a>';
        }
        $output .= '</header>';
        $nopaging = 'true';
    } else {
        $output = '<section class="portfolios">';
    }
    $output .= '<ul class="portfolio_' . $column_class . '">';
    if ($nopaging == 'false') {
        $paged = get_query_var('paged') ? get_query_var('paged') : 1;
        query_posts(array('post_type' => 'portfolio', 'posts_per_page' => $max, 'taxonomy' => 'portfolio_category', 'term' => $cat, 'paged' => $paged, 'orderby' => 'menu_order', 'order' => 'ASC'));
    } else {
        query_posts(array('post_type' => 'portfolio', 'taxonomy' => 'portfolio_category', 'showposts' => -1, 'term' => $cat, 'orderby' => 'menu_order', 'order' => 'ASC'));
    }
    $i = 1;
    if ($column == 1) {
        global $more;
        $more = 0;
    }
    while (have_posts()) {
        the_post();
        $terms = get_the_terms(get_the_id(), 'portfolio_category');
        $terms_slug = array();
        if (is_array($terms)) {
            foreach ($terms as $term) {
                $terms_slug[] = $term->slug;
            }
        }
        if ($i % $column == 0 && $column != 1) {
            $output .= '<li data-id="' . get_the_id() . '" data-type="' . implode(',', $terms_slug) . '">';
        } else {
            $output .= '<li data-id="' . get_the_id() . '" data-type="' . implode(',', $terms_slug) . '">';
        }
        $i++;
        if (has_post_thumbnail()) {
            $image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_id()), 'full', true);
            $type = get_post_meta(get_the_id(), '_type', true);
            if ($type == 'image') {
                $href = get_post_meta(get_the_id(), '_video', true);
                $href = get_post_meta(get_the_id(), '_image', true);
                if (empty($href)) {
                    $href = $image[0];
                }
                $icon = 'zoom';
                $lightbox = ' lightbox';
                $rel = ' rel="' . $group . '"';
            } elseif ($type == 'video') {
                $href = get_post_meta(get_the_id(), '_video', true);
                if (empty($href)) {
                    $href = $image[0];
                }
                $icon = 'play';
                $lightbox = ' lightbox';
                $rel = ' rel="' . $group . '"';
            } elseif ($type == 'link') {
                $link = get_post_meta(get_the_ID(), '_link', true);
                $href = theme_get_superlink($link);
                $link_target = get_post_meta(get_the_ID(), '_link_target', true);
                $link_target = $link_target ? $link_target : '_self';
                $icon = 'link';
                $lightbox = '';
                $rel = '';
            } else {
                $href = get_permalink();
                $icon = 'doc';
                $lightbox = '';
                $rel = '';
            }
            $override_icon = get_post_meta(get_the_ID(), '_icon', true);
            if ($override_icon && $override_icon != 'default') {
                $icon = $override_icon;
            }
            $output .= '<div class="image_styled portfolio_image">';
            $output .= '<span class="image_frame" style="height:' . $size[1] . 'px">';
            $output .= '<a class="image_icon_' . $icon . $lightbox . '" ' . (isset($link_target) ? 'target="' . $link_target . '" ' : '') . ' href="' . $href . '"' . $rel . '>';
            $output .= '<img src="' . THEME_INCLUDES . '/timthumb.php?src=' . get_image_src($image[0]) . '&amp;h=' . $size[1] . '&amp;w=' . $size[0] . '&amp;zc=1' . '" title="' . get_the_title() . '" alt="' . get_the_title() . '" />';
            $output .= '</a>';
            $output .= '</span>';
            $output .= '<img src="' . THEME_IMAGES . '/image_shadow.png" class="image_shadow">';
            $output .= '</div>';
        }
        $output .= '<div class="portfolio_details">';
        if (theme_get_option('portfolio', 'display_title') || $column == 1) {
            $output .= '<div class="portfolio_title">' . get_the_title() . '</div>';
        }
        if (theme_get_option('portfolio', 'display_excerpt') || $column == 1) {
            if ($column == 1) {
                $output .= '<div class="portfolio_desc">' . apply_filters('the_content', get_the_content()) . '</div>';
            } else {
                $output .= '<div class="portfolio_desc">' . get_the_excerpt() . '</div>';
            }
        }
        $more = get_post_meta(get_the_id(), '_more', true);
        if (theme_get_option('portfolio', 'display_more_button') && $more != '-1') {
            $more_link = theme_get_superlink(get_post_meta(get_the_id(), '_more_link', true), get_permalink());
            $more_link_target = get_post_meta(get_the_ID(), '_link_target', true);
            $more_link_target = $more_link_target ? $more_link_target : '_self';
            $output .= '<div class="portfolio_more_button"><a href="' . $more_link . '" target="' . $more_link_target . '"><span>' . wpml_t(THEME_NAME, 'Portfolio More Button Text', theme_get_option('portfolio', 'more_button_text')) . '</span></a></div>';
        }
        $output .= '</div>';
        $output .= '</li>';
    }
    $output .= '</ul>';
    if ($nopaging == 'false') {
        ob_start();
        theme_portfolio_pagenavi('', '', $paged);
        $output .= ob_get_clean();
    }
    $output .= '</section>';
    wp_reset_query();
    $wp_filter['the_content'] = $the_content_filter_backup;
    return $output;
}
Ejemplo n.º 7
0
/**
 * resizes a file and writes it back to the user! - can do jpg, png and gif if the support is there !
 * renamed png's (that that are actually jpg's are handled as well!)
 * Needs gdlib > 2.0!
 */
function send_thumb($image, $compression, $sizex, $sizey, $generateOnly = false)
{
    global $bg_color_preview_R, $bg_color_preview_G, $bg_color_preview_B;
    global $info_text, $info_textcolor_R, $info_textcolor_G, $info_textcolor_B, $info_font, $info_fontsize;
    set_error_handler('on_error_no_output');
    ini_set('gd.jpeg_ignore_warning', 1);
    // since php 5.1.3 this leads that corrupt jpgs are read much better!
    set_error_handler('on_error');
    $srcx = 0;
    $srcy = 0;
    $dimx = $sizex;
    $dimy = $sizey;
    $usethumbs = false;
    if (file_exists(dirname(__FILE__) . '/thumbs') && is_writable(dirname(__FILE__) . '/thumbs')) {
        // is a caching dir available and writeable?
        $cachename = dirname(__FILE__) . '/thumbs/' . sha1($image . $sizex) . '.jpg';
        $usethumbs = true;
    }
    if ($usethumbs && file_exists($cachename)) {
        // we return the jpg!
        header('Content-type: image/jpg');
        header('Content-Length: ' . filesize($cachename));
        $fp = fopen($cachename, 'rb');
        while ($content = fread($fp, 8192)) {
            print $content;
        }
        fclose($fp);
        return true;
    } else {
        if (file_exists($image)) {
            if (filesize($image) == 0) {
                return false;
            }
            $oldsize = getimagesize($image);
            // for broken images we try to read the exif data!
            if ($oldsize[0] == 0) {
                $oldsize = get_exif_size($image, $image);
            }
            $oldsizex = $oldsize[0];
            $oldsizey = $oldsize[1];
            if ($oldsizex < $sizex && $oldsizey < $sizey) {
                $sizex = $oldsizex;
                $sizey = $oldsizey;
            }
            $height = $sizey;
            $width = $height / $oldsizey * $oldsizex;
            if ($width > $sizex) {
                $width = $sizex;
                $height = $width / $oldsizex * $oldsizey;
            }
            if (isMemoryOk($oldsize, $sizex, '')) {
                $src = get_image_src($image, $oldsize[2]);
                if (!$src) {
                    // error in image!
                    if ($sizex < 100) {
                        // we return an empty white one ;).
                        $src = ImageCreateTrueColor($oldsizex, $oldsizey);
                        $back = imagecolorallocate($src, 255, 255, 255);
                        imagefilledrectangle($src, 0, 0, $oldsizex, $oldsizex, $back);
                    }
                    tfu_debug($image . ' is not a valid image - please check the file.');
                    return false;
                }
                // $dst = ImageCreateTrueColor($width, $height);
                $dst = ImageCreateTrueColor($dimx, $dimy);
                if ($dimx < 100) {
                    // white bg for small preview
                    $back = imagecolorallocate($dst, $bg_color_preview_R, $bg_color_preview_G, $bg_color_preview_B);
                } else {
                    // gray bg for big preview
                    $back = imagecolorallocate($dst, 245, 245, 245);
                }
                imagefilledrectangle($dst, 0, 0, $dimx, $dimy, $back);
                if ($dimx > 100) {
                    // border
                    imagerectangle($dst, 0, 0, $dimx - 1, $dimy - 1, imagecolorallocate($dst, 160, 160, 160));
                }
                $offsetx = 0;
                $offsetx_b = 0;
                if ($dimx > $width) {
                    // we have to center!
                    $offsetx = floor(($dimx - $width) / 2);
                } else {
                    if ($dimx > 100) {
                        $offsetx = 4;
                        $offsetx_b = 8;
                    }
                }
                $offsety = 0;
                $offsety_b = 0;
                if ($dimy > $height) {
                    // we have to center!
                    $offsety = floor(($dimy - $height) / 2);
                } else {
                    if ($dimx > 100) {
                        $offsety = 4;
                        $offsety_b = 8;
                    }
                }
                $trans = imagecolortransparent($src);
                imagecolorset($src, $trans, 255, 255, 255);
                imagecolortransparent($src, imagecolorallocate($src, 0, 0, 0));
                imagecopyresampled($dst, $src, $offsetx, $offsety, $srcx, $srcy, $width - $offsetx_b, $height - $offsety_b, $oldsizex, $oldsizey);
                if (function_exists("imagettftext") && $dimx > 100 && $info_text != '') {
                    // some extra info at the bottom of the image. Available parameters: {date} {size} {dimension}
                    $text = str_replace('{dimension}', $oldsizex . "x" . $oldsizey, $info_text);
                    $text = str_replace('{size}', formatSize(filesize($image)), $text);
                    $text = str_replace('{date}', date("d.m.Y", filemtime($image)), $text);
                    $color = imagecolorclosest($dst, $info_textcolor_R, $info_textcolor_G, $info_textcolor_B);
                    imagettftext($dst, $info_fontsize, 0, 8, $dimy - 8, $color, $info_font, $text);
                }
                header('Content-type: image/jpg');
                if ($usethumbs) {
                    // we save the thumb
                    imagejpeg($dst, $cachename, $compression);
                }
                if (!$generateOnly) {
                    ob_start();
                    if (imagejpeg($dst, '', $compression)) {
                        $buffer = ob_get_contents();
                        header('Content-Length: ' . strlen($buffer));
                        ob_end_clean();
                        echo $buffer;
                        @imagedestroy($dst);
                        return true;
                    } else {
                        ob_end_flush();
                        tfu_debug('cannot save: ' . $image);
                        @imagedestroy($src);
                    }
                }
            }
        }
    }
    return false;
}
Ejemplo n.º 8
0
 $related_post_found = false;
 $output = '';
 if (!empty($tagIDs) || !empty($catIDs)) {
     $r = new WP_Query(array('tag__in' => $tagIDs, 'category__in' => $catIDs, 'post__not_in' => array($post->ID), 'showposts' => 3, 'caller_get_posts' => 1));
     if ($r->have_posts()) {
         $related_post_found = true;
         $output .= '<div class="related_posts_wrap">';
         $output .= '<h3>' . __('Related Posts', 'striking_front') . '</h3>';
         $output .= '<ul class="related_posts_list">';
         while ($r->have_posts()) {
             $r->the_post();
             $output .= '<li>';
             $output .= '<a class="thumbnail" href="' . get_permalink() . '" title="' . get_the_title() . '">';
             if (has_post_thumbnail()) {
                 $image_src_array = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full', true);
                 $image_src = THEME_INCLUDES . '/timthumb.php?src=' . get_image_src($image_src_array[0]) . '&amp;h=80&amp;w=192&amp;zc=1';
                 $output .= '<img src="' . $image_src . '" alt="' . get_the_title() . '" />';
             } else {
                 $output .= '<img src="' . THEME_IMAGES . '/related_posts_thumbnail.png" width="192" height="80" title="' . get_the_title() . '" alt="' . get_the_title() . '"/>';
             }
             $output .= '</a>';
             $output .= '<div class="post_extra_info">';
             $output .= '<a class="post_title" href="' . get_permalink() . '" title="' . get_the_title() . '" rel="bookmark">' . get_the_title() . '</a>';
             $output .= '<time datetime="' . get_the_time('Y-m-d') . '">' . get_the_date() . '</time>';
             $output .= '</div>';
             $output .= '<div class="clearboth"></div>';
             $output .= '</li>';
         }
         $output .= '</ul>';
         $output .= '<div class="clearboth"></div>';
         $output .= '</div>';
Ejemplo n.º 9
0
function theme_shortcode_picture_frame($atts, $content = null)
{
    extract(shortcode_atts(array('title' => '', 'align' => false), $atts));
    return '<div class="picture_frame"><img width ="106" height="126" alt="' . $title . '" src="' . THEME_INCLUDES . '/timthumb.php?src=' . get_image_src($content) . '&amp;h=126&amp;w=106&amp;zc=1" /></div>';
}
/**
 * generate a table with images and a useful magnifying image viewer
 * @param unknown_type $results
 * @param result if true return the contents instead of printing it out
 */
function blended_display_results_images($results, $return = false)
{
    $output = '<table border="0">';
    foreach ($results as $record) {
        $src = get_image_src($record->imgout);
        $pageindex = $record->pageindex;
        /**
         * Magnifying glass
         */
        $magnifiedImg = '<div style="float:right" onmouseover="zoom_on(event,700,990,\'' . $src . '\');" onmousemove="zoom_move(event);" onmouseout="zoom_off();"><A HREF="' . $src . '" rel="thumbnail"><img src="' . $src . '" alt="Scanned Quiz" style="padding:0;margin:0;border:0" /></A></div><div style="clear:both;"></div>';
        $magnifiedImg3 = '<div>
<img src="' . $src . '" style="width:700px; height: 990px;" onmouseover="TJPzoom(this);">
</div>';
        $img = "<A HREF=\"{$src}\" rel=\"thumbnail\"><img src=\"{$src}\" width=\"700\" /></A>";
        $img = $magnifiedImg3;
        //			$img->fullImage="<img src=\"$src\" height=\"1020\" width=\"800\" />";
        // 			if ($i == 0)
        // 			{
        //print($img0);
        /* 			echo "<td><A HREF=\"$CFG->wwwroot/mod/blended/image.php?&a=$a&acode=$acode
         			&jobid=$jobid&navpage=$currentpage&pageindex=$pageindex\" >$img0</td></tr>";*/
        $output .= "<tr><td>{$img}</td></tr>";
        // 			}
        //
        // 			else
        // 			{
        //
        // 			$image2=$img->$name;
        /*			echo "</tr><td></td><td><A HREF=\"$CFG->wwwroot/mod/blended/image.php?&a=$a&acode=$acode
         			&jobid=$jobid&navpage=$currentpage&pageindex=$pageindex\" >$image2</A></td>";*/
        //			echo "</tr><td></td><td><A HREF=\"$src\" rel=\"thumbnail\">$image2</A></td>";
        //
        // 			}
        //
        // 			$i=$i+1;
    }
    //foreach
    $output .= '</table>';
    if ($return) {
        return $output;
    } else {
        echo $output;
    }
}