problema para mostrar los thumbnails en mi blog

Inicio Foros Comunidad Presenta tu Blog problema para mostrar los thumbnails en mi blog

Este debate contiene 2 respuestas, tiene 2 mensajes y lo actualizó  puntoocx hace 7 años, 1 mes.

  • Autor
    Publicaciones
  • #21694

    puntoocx
    Participante

    <p>este es mi blog http://www.misesion.com/<br />
    tengo problemas con los thumbnails en mi blog</p>
    <p>me gustaria que me ayudaran de que manera puedo solucionar esto. Gracias por su ayuda
    </p>

  • #53420

    Antonio Rodriguez
    Participante

    plantea cual es el problema, pon el codigo que tienes puesto, dinos que dudas tienas,,, si no te extiendes un poco mas en los datos que aportas, dificilmente podemos ayudar…

  • #53455

    puntoocx
    Participante

    estoy utilizando este theme http://ericulous.com/2010/08/24/wp-theme-hackerwp/

    lo que quiero es que aparezcan los thumbnails en la cabecera.Lo que no se a que se deba. bueno aqui te dejo el codigo de la cabecera. y de los thumbnails

    [b]header[/b]

    <!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” <?php language_attributes(); ?>>

    <head profile=”http://gmpg.org/xfn/11″>
    <meta http-equiv=”Content-Type” content=”<?php bloginfo(‘html_type’); ?>; charset=<?php bloginfo(‘charset’); ?>” />

    <title><?php if(is_home() || is_search()) { bloginfo(‘name’); echo ‘ » ‘; bloginfo(‘description’); } else { wp_title(”); echo ‘ » ‘; bloginfo(‘name’); } ?></title>

    <link rel=”stylesheet” href=”<?php bloginfo(‘stylesheet_url’) ?>” type=”text/css” media=”screen” />

    <?php if (!function_exists(‘automatic_feed_links’)) { ?>
    <link rel=”alternate” type=”application/rss+xml” title=”<?php bloginfo(‘name’); ?> RSS Feed” href=”<?php bloginfo(‘rss2_url’); ?>” />
    <link rel=”alternate” type=”application/atom+xml” title=”<?php bloginfo(‘name’); ?> Atom Feed” href=”<?php bloginfo(‘atom_url’); ?>” />
    <?php } ?>

    <link rel=”pingback” href=”<?php bloginfo(‘pingback_url’); ?>” />

    <?php if ( is_singular() ) wp_enqueue_script( ‘comment-reply’ ); ?>
    <?php wp_head(); ?>
    <?php global $hackerwp; ?>
    </head>
    <body<?php if (function_exists(‘body_class’)) { echo ‘ ‘; body_class(); } ?>>
    <div class=”container”>
    <div class=”headergallery”>
    <?php $my_query = new WP_Query(‘category_name=featured&showposts=3’); ?>
    <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <div class=”headergalleryimage”>
    <?php if (get_post_meta($post->ID, “featuredimage”, true) != ”) { ?>
    ” title=”<?php the_title() ?>”>
    /timthumb.php?src=<?php echo urlencode(get_post_meta($post->ID, “featuredimage”, true)) ?>&w=185&h=185&zc=1″ alt=”<?php the_title() ?>” />

    <?php } elseif (preg_match(‘/<img([^>]*)>/i’, get_the_content(), $match) != FALSE) {
    preg_match(‘/src=([‘”])([^'”1]+)1/i’, $match[1], $imagesrc);
    $url = $imagesrc[2];
    ?>
    ” title=”<?php the_title() ?>”>
    /timthumb.php?src=<?php echo urlencode($url); ?>&w=185&h=185&zc=1″ alt=”<?php the_title() ?>” />

    <?php } ?>

    ” title=”<?php the_title() ?>”><?php the_title() ?>

    <span class=”cats”>
    <?php
    foreach((get_the_category()) as $category) {
    echo ‘cat_ID) . ‘” title=”‘ . $category->cat_name . ‘”>#’ . $category->cat_name . ‘ ‘;
    }
    ?></span>
    </div>
    <?php endwhile; ?>
    <div style=”float:right;”>
    <?php if ($hackerwp->option[‘adstop’] !=”) { ?>
    <?php eval(‘?>’.$hackerwp->option[‘adstop’]); ?>
    <?php } ?>
    </div>
    </div>

    <div style=”clear:both”></div>

    <div class=”header”>
    <div class=”logo”>
    /”>/images/logo.gif” alt=”logo” />
    </div>

    <?php if (function_exists(‘wp_nav_menu’) && has_nav_menu(‘top-menu’ )) {
    wp_nav_menu( array( ‘theme_location’ => ‘top-menu’, ‘container’ => ”, ‘menu_id’ => ‘nav’, ‘menu_class’ => ‘clearfloat’) );
    } else { ?>
    <ul id=”nav” class=”clearfloat”>
    <?php wp_list_pages(‘title_li=&depth=1’ ); ?>

    <?php } ?>

    /images/facebook.png” width=”20″ alt=”Find us on Facebook” />
    /images/twitter.png” width=”20″ alt=”Follow us on Tiwtter” />
    ” title=”Subscribe Feed”>/images/rss.png” width=”20″ alt=”Subscribe Feed” />
    <div class=”search”>
    <form method=”get” id=”sform” action=”<?php bloginfo(‘home’); ?>/”>
    <input type=”text” id=”q” value=”<?php echo wp_specialchars($s, 1); ?>” name=”s” size=”15″ />
    </form>
    </div>
    </div><!– end header –>

    [b]thumbnails[/b]

    <?php

    // TimThumb script created by Tim McDaniels and Darren Hoyt with tweaks by Ben Gillbanks
    // http://code.google.com/p/timthumb/

    // MIT License: http://www.opensource.org/licenses/mit-license.php

    /* Parameters allowed: */

    // w: width
    // h: height
    // zc: zoom crop (0 or 1)
    // q: quality (default is 75 and max is 100)

    // HTML example:

    if( !isset( $_REQUEST[ “src” ] ) ) { die( “no image specified” ); }

    // clean params before use
    $src = $_REQUEST[ “src” ]; //edited: remove clean_source

    // set document root
    //edited: commented // out $doc_root = get_document_root($src);

    // get path to image on file system
    //edited: commented out/ / $src = $doc_root . ‘/’ . $src;

    $new_width = preg_replace( “/[^0-9]+/”, “”, get_request( ‘w’, 128 ) );
    $new_height = preg_replace( “/[^0-9]+/”, “”, get_request( ‘h’, 128 ) );
    $zoom_crop = preg_replace( “/[^0-9]+/”, “”, get_request( ‘zc’, 1 ) );
    $quality = preg_replace( “/[^0-9]+/”, “”, get_request( ‘9’, 75 ) );

    // set path to cache directory (default is ./cache)
    // this can be changed to a different location
    $cache_dir = ‘./cache’;

    // get mime type of src
    $mime_type = mime_type( $src );

    // check to see if this image is in the cache already
    check_cache( $cache_dir, $mime_type );

    // make sure that the src is gif/jpg/png
    if( !valid_src_mime_type( $mime_type ) ) {
    $error = “Invalid src mime type: $mime_type”;
    die( $error );
    }

    // check to see if GD function exist
    if(!function_exists(‘imagecreatetruecolor’)) {
    $error = “GD Library Error: imagecreatetruecolor does not exist”;
    die( $error );
    }

    if(strlen($src)) { //edited:

    // open the existing image
    $image = open_image( $mime_type, $src );
    if( $image === false ) { die( ‘Unable to open image : ‘ . $src ); }

    // Get original width and height
    $width = imagesx( $image );
    $height = imagesy( $image );

    // don’t allow new width or height to be greater than the original
    if( $new_width > $width ) { $new_width = $width; }
    if( $new_height > $height ) { $new_height = $height; }

    // generate new w/h if not provided
    if( $new_width && !$new_height ) {
    $new_height = $height * ( $new_width / $width );
    }
    elseif($new_height && !$new_width) {
    $new_width = $width * ( $new_height / $height );
    }
    elseif(!$new_width && !$new_height) {
    $new_width = $width;
    $new_height = $height;
    }

    // create a new true color image
    $canvas = imagecreatetruecolor( $new_width, $new_height );

    if( $zoom_crop ) {

    $src_x = $src_y = 0;
    $src_w = $width;
    $src_h = $height;

    $cmp_x = $width / $new_width;
    $cmp_y = $height / $new_height;

    // calculate x or y coordinate and width or height of source

    if ( $cmp_x > $cmp_y ) {

    $src_w = round( ( $width / $cmp_x * $cmp_y ) );
    $src_x = round( ( $width – ( $width / $cmp_x * $cmp_y ) ) / 2 );

    }
    elseif ( $cmp_y > $cmp_x ) {

    $src_h = round( ( $height / $cmp_y * $cmp_x ) );
    $src_y = round( ( $height – ( $height / $cmp_y * $cmp_x ) ) / 2 );

    }

    imagecopyresampled( $canvas, $image, 0, 0, $src_x, $src_y, $new_width, $new_height, $src_w, $src_h );

    }
    else {

    // copy and resize part of an image with resampling
    imagecopyresampled( $canvas, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height );

    }

    // output image to browser based on mime type
    show_image( $mime_type, $canvas, $quality, $cache_dir );

    // remove image from memory
    imagedestroy( $canvas );

    } else {

    if( strlen( $src ) ) { echo $src . ‘ not found.’; } else { echo ‘no source specified.’; }

    }

    function show_image ( $mime_type, $image_resized, $quality, $cache_dir ) {

    // check to see if we can write to the cache directory
    $is_writable = 0;
    $cache_file_name = $cache_dir . ‘/’ . get_cache_file();

    if( touch( $cache_file_name ) ) {
    // give 666 permissions so that the developer
    // can overwrite web server user
    chmod( $cache_file_name, 0666 );
    $is_writable = 1;
    }
    else {
    $cache_file_name = NULL;
    header( ‘Content-type: ‘ . $mime_type );
    }

    if( stristr( $mime_type, ‘gif’ ) ) {
    imagegif( $image_resized, $cache_file_name );
    }
    elseif( stristr( $mime_type, ‘jpeg’ ) ) {
    imagejpeg( $image_resized, $cache_file_name, $quality );
    }
    elseif( stristr( $mime_type, ‘png’ ) ) {
    imagepng( $image_resized, $cache_file_name, ceil( $quality / 10 ) );
    }
    if( $is_writable ) { show_cache_file( $cache_dir, $mime_type ); }
    exit;

    }

    function get_request( $property, $default = 0 ) {

    if( isset($_REQUEST[$property]) ) {
    return $_REQUEST[$property];
    } else {
    return $default;
    }

    }

    function open_image ( $mime_type, $src ) {

    if( stristr( $mime_type, ‘gif’ ) ) {
    $image = imagecreatefromgif( $src );
    }
    elseif( stristr( $mime_type, ‘jpeg’ ) ) {
    @ini_set(‘gd.jpeg_ignore_warning’, 1);
    $image = imagecreatefromjpeg( $src );
    }
    elseif( stristr( $mime_type, ‘png’ ) ) {
    $image = imagecreatefrompng( $src );
    }
    return $image;

    }

    function mime_type ( $file ) {

    $os = strtolower(php_uname());
    $mime_type = ”;

    // use PECL fileinfo to determine mime type
    if( function_exists( ‘finfo_open’ ) ) {
    $finfo = finfo_open( FILEINFO_MIME );
    $mime_type = finfo_file( $finfo, $file );
    finfo_close( $finfo );
    }

    // try to determine mime type by using unix file command
    // this should not be executed on windows
    if( !valid_src_mime_type( $mime_type ) && !(eregi(‘windows’, php_uname()))) {
    if( preg_match( “/freebsd|linux/”, $os ) ) {
    $mime_type = trim ( @shell_exec( ‘file -bi $file’ ) );
    }
    }

    // use file’s extension to determine mime type
    if( !valid_src_mime_type( $mime_type ) ) {
    $frags = split( “.”, $file );
    $ext = strtolower( $frags[ count( $frags ) – 1 ] );
    $types = array(
    ‘jpg’ => ‘image/jpeg’,
    ‘jpeg’ => ‘image/jpeg’,
    ‘png’ => ‘image/png’,
    ‘gif’ => ‘image/gif’
    );
    if( strlen( $ext ) && strlen( $types[$ext] ) ) {
    $mime_type = $types[ $ext ];
    }

    // if no extension provided, default to jpg
    if( !strlen( $ext ) && !valid_src_mime_type( $mime_type ) ) {
    $mime_type = ‘image/jpeg’;
    }
    }
    return $mime_type;

    }

    function valid_src_mime_type ( $mime_type ) {

    if( preg_match( “/jpg|jpeg|gif|png/i”, $mime_type ) ) { return 1; }
    return 0;

    }

    function check_cache ( $cache_dir, $mime_type ) {

    // make sure cache dir exists
    if( !file_exists( $cache_dir ) ) {
    // give 777 permissions so that developer can overwrite
    // files created by web server user
    mkdir( $cache_dir );
    chmod( $cache_dir, 0777 );
    }

    show_cache_file( $cache_dir, $mime_type );

    }

    function show_cache_file ( $cache_dir, $mime_type ) {

    $cache_file = $cache_dir . ‘/’ . get_cache_file();

    if( file_exists( $cache_file ) ) {

    if( isset( $_SERVER[ “HTTP_IF_MODIFIED_SINCE” ] ) ) {

    // check for updates
    $if_modified_since = preg_replace( ‘/;.*$/’, ”, $_SERVER[ “HTTP_IF_MODIFIED_SINCE” ] );
    $gmdate_mod = gmdate( ‘D, d M Y H:i:s’, filemtime( $cache_file ) );

    if( strstr( $gmdate_mod, ‘GMT’ ) ) {
    $gmdate_mod .= ” GMT”;
    }

    if ( $if_modified_since == $gmdate_mod ) {
    header( “HTTP/1.1 304 Not Modified” );
    exit;
    }

    }

    $fileSize = filesize( $cache_file );

    // send headers then display image
    header( “Content-Type: ” . $mime_type );
    header( “Accept-Ranges: bytes” );
    header( “Last-Modified: ” . gmdate( ‘D, d M Y H:i:s’, filemtime( $cache_file ) ) . ” GMT” );
    header( “Content-Length: ” . $fileSize );
    header( “Cache-Control: max-age=9999, must-revalidate” );
    header( “Etag: ” . md5($fileSize . $gmdate_mod) );
    header( “Expires: ” . gmdate( “D, d M Y H:i:s”, time() + 9999 ) . “GMT” );
    readfile( $cache_file );
    exit;

    }

    }

    function get_cache_file () {

    global $quality;

    static $cache_file;
    if(!$cache_file) {
    $frags = split( “.”, $_REQUEST[‘src’] );
    $ext = strtolower( $frags[ count( $frags ) – 1 ] );
    if(!valid_extension($ext)) { $ext = ‘jpg’; }
    $cachename = get_request( ‘src’, ‘timthumb’ ) . get_request( ‘w’, 100 ) . get_request( ‘h’, 100 ) . get_request( ‘zc’, 1 ) . get_request( ‘9’, 75 );
    $cache_file = md5( $cachename ) . ‘.’ . $ext;
    }
    return $cache_file;

    }

    function valid_extension ($ext) {

    if( preg_match( “/jpg|jpeg|png|gif/i”, $ext ) ) return 1;
    return 0;

    }

    function clean_source ( $src ) {

    // remove http/ https/ ftp
    $src = preg_replace(“/^((ht|f)tp(s|)://)/i”, “”, $src);
    // remove domain name from the source url
    $src = str_replace($_SERVER[“HTTP_HOST”], “”, $src);

    //$src = preg_replace( “/(?:^/+|.{2,}/+?)/”, “”, $src );
    //$src = preg_replace( ‘/^w+://[^/]+/’, ”, $src );

    // don’t allow users the ability to use ‘../’
    // in order to gain access to files below document root

    // src should be specified relative to document root like:
    // src=images/img.jpg or src=/images/img.jpg
    // not like:
    // src=../images/img.jpg
    $src = preg_replace( “/..+//”, “”, $src );

    return $src;

    }

    function get_document_root ($src) {
    if( @file_exists( $_SERVER[‘DOCUMENT_ROOT’] . ‘/’ . $src ) ) {
    return $_SERVER[‘DOCUMENT_ROOT’];
    }
    // the relative paths below are useful if timthumb is moved outside of document root
    // specifically if installed in wordpress themes like mimbo pro:
    // /wp-content/themes/mimbopro/scripts/timthumb.php
    $paths = array( ‘..’, ‘../..’, ‘../../..’, ‘../../../..’ );
    foreach( $paths as $path ) {
    if( @file_exists( $path . ‘/’ . $src ) ) {
    return $path;
    }
    }

    }

    ?>

El foro ‘Presenta tu Blog’ está cerrado y no se permiten nuevos debates ni respuestas.

Pin It on Pinterest