• 12-03-2009, 17:05:04
    #1
    Kimlik doğrulama veya yönetimden onay bekliyor.
    merhaba ,

    Arkadaşlar wordpress temamın thumbnail kısmında sadece kendi images kısmındaki resimleri gösteriyor. Başka urldeki resimleri çalıştırmıyor. Bu hatayı nasıl düzeltebilirim. Yardımcı olursanız sevinirim..

    Şu anda elimdeki kodlar bunlar :
     <?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: <img src="/scripts/timthumb.php?src=/images/whatever.jpg&w=150&h=200&zc=1" alt="" />
    
    if( !isset( $_REQUEST[ "src" ] ) ) {
    	die( "no image specified" );
    }
    
    // clean params before use
    $src = clean_source( $_REQUEST[ "src" ] );
    
    // set document root
    $doc_root = get_document_root($src);
    
    // get path to image on file system
    $src = $doc_root . '/' . $src;
    
    $new_width = preg_replace( "/[^0-9]+/", "", get_request( 'w', 100 ) );
    $new_height = preg_replace( "/[^0-9]+/", "", get_request( 'h', 100 ) );
    $zoom_crop = preg_replace( "/[^0-9]+/", "", get_request( 'zc', 1 ) );
    $quality = preg_replace( "/[^0-9]+/", "", get_request( '9', 80 ) );
    
    // 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) && file_exists( $src ) ) {
    
    	// 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' ) ) {
    	
    		$quality = $quality / 10;
    		if($quality == 10) {
    			$quality = 9;
    		}
    		imagepng( $image_resized, $cache_file_name, $quality );
    		
    	}
    	
    	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', 80 );
    		$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
    	$host = $_SERVER["HTTP_HOST"];
    	$src = str_replace($host, "", $src);
    	$host = str_replace("www.", "", $host);
    	$src = str_replace($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;
    		}
    	}
    
    }
    
    ?>
  • 12-03-2009, 17:42:14
    #2
    Bu timthumb scriptinin kaynak kodları. Konunun timthumb ile alakası olduğunu sanmıyorum... index.php ve functions.php dosyasını verirseniz yardımcı olabiliriz sanırım
  • 12-03-2009, 18:50:03
    #3
    Function.php
    <?php 
    
    function the_title2($before = '', $after = '', $echo = true, $length = false) {
             $title = get_the_title();
    
          if ( $length && is_numeric($length) ) {
    
                 $title = substr( $title, 0, $length );
    
              }
    
            if ( strlen($title)> 0 ) {
    
                 $title = apply_filters('the_title2', $before . $title . $after, $before, $after);
    
                 if ( $echo )
    
                    echo $title;
    
                 else
    
                    return $title;
    
              }
    
          }
    ?>
    <?php  
    $new_meta_boxes =  
    array(  
    "image" => array(  
    "name" => "image",  
    "std" => "",  
    "title" => "Thumbnail Image",  
    "description" => "Place the full path your your image here to have it displayed as a thumbnail")  
    );  
    function new_meta_boxes() {  
    global $post, $new_meta_boxes;  
    
    foreach($new_meta_boxes as $meta_box) {  
    $meta_box_value = get_post_meta($post->ID, $meta_box['name'].'_value', true);  
    
    if($meta_box_value == "")  
    $meta_box_value = $meta_box['std'];  
     
    echo'<input type="hidden" name="'.$meta_box['name'].'_noncename" id="'.$meta_box['name'].'_noncename" value="'.wp_create_nonce( plugin_basename(__FILE__) ).'" />';  
      
    echo'<h2>'.$meta_box['title'].'</h2>';  
      
    echo'<input type="text" name="'.$meta_box['name'].'_value" value="'.$meta_box_value.'" size="55" /><br />';  
     
    echo'<p><label for="'.$meta_box['name'].'_value">'.$meta_box['description'].'</label></p>';  
    }  
    }
    function create_meta_box() {  
    global $theme_name;  
    if ( function_exists('add_meta_box') ) {  
    add_meta_box( 'new-meta-boxes', 'eGamer Thumbnail Settings', 'new_meta_boxes', 'post', 'normal', 'high' );  
    }
    }
    function save_postdata( $post_id ) {  
    global $post, $new_meta_boxes;  
    
    foreach($new_meta_boxes as $meta_box) {  
    // Verify  
    if ( !wp_verify_nonce( $_POST[$meta_box['name'].'_noncename'], plugin_basename(__FILE__) )) {  
    return $post_id;  
    }  
    
    if ( 'page' == $_POST['post_type'] ) {  
    if ( !current_user_can( 'edit_page', $post_id ))  
    return $post_id;  
    } else {  
    if ( !current_user_can( 'edit_post', $post_id ))  
    return $post_id;  
    }  
      
    $data = $_POST[$meta_box['name'].'_value'];  
     
    if(get_post_meta($post_id, $meta_box['name'].'_value') == "")  
    add_post_meta($post_id, $meta_box['name'].'_value', $data, true);  
    elseif($data != get_post_meta($post_id, $meta_box['name'].'_value', true))  
    update_post_meta($post_id, $meta_box['name'].'_value', $data);  
    elseif($data == "")  
    delete_post_meta($post_id, $meta_box['name'].'_value', get_post_meta($post_id, $meta_box['name'].'_value', true));  
    }  
    }
    add_action('admin_menu', 'create_meta_box');  
    add_action('save_post', 'save_postdata');  
    ?>
    <?php
    if ( function_exists('register_sidebar') )
        register_sidebar(array(
            'before_widget' => '<div class="sidebar-box">',
        'after_widget' => '</div>',
     'before_title' => '<h3>',
            'after_title' => '</h3>',
        ));
    ?>
    <?php
    $themename = "eGamer Theme";
    $shortname = "artsee";
    $options = array (
    
        array(    "name" => "Layout Settings",
                "type" => "titles",),
    			
    	array(    "name" => "<span style='float: left;'>Post Format</span>",
                "id" => $shortname."_format",
                "type" => "select",
                "std" => "Default",
                "options" => array("Default", "Blog Style")),
    					
        array(    "name" => "Homepage Options",
                "type" => "titles"),
    
    	array(    "name" => "Hide/Display Recent Video",
                "id" => $shortname."_video",
                "type" => "select",
                "std" => "Hide",
                "options" => array("Display", "Hide")),
    			
    	array(    "name" => "Hide/Display son Reviews",
                "id" => $shortname."_rating",
                "type" => "select",
                "std" => "Hide",
                "options" => array("Display", "Hide")),
    			
    	array(    "name" => "Hide/Display Random/Popular Articles",
                "id" => $shortname."_popular",
                "type" => "select",
                "std" => "Display",
                "options" => array("Display", "Hide")),
    			
        array(    "name" => "Number of Recent-Posts Displayed on Homepage",
                "id" => $shortname."_homepage_posts",
                "std" => "6",
                "type" => "text"),
    			
        array(    "name" => "Number of Featured-Posts Displayed on Homepage",
                "id" => $shortname."_homepage_featured",
                "std" => "3",
                "type" => "text"),
    			
        array(    "name" => "Post-Page Options",
                "type" => "titles"),
    			
    	array(    "name" => "<span style='float: left;'>Hid/Display Thumbnails on Post Pages</span>",
                "id" => $shortname."_thumbnails",
                "type" => "select",
                "std" => "Display",
                "options" => array("Display", "Hide")),
    			
    	array(    "name" => "<span style='float: left;'>Hid/Display Tabbed Menu</span>",
                "id" => $shortname."_posttabs",
                "type" => "select",
                "std" => "Display",
                "options" => array("Display", "Hide")),
    			
    	array(    "name" => "<span style='float: left;'>Comments Style</span>",
                "id" => $shortname."_comments",
                "type" => "select",
                "std" => "Graphical",
                "options" => array("Graphical", "Minimal")),
    
        array(    "name" => "Navigation Options",
                "type" => "titles"),
    			
        array(    "name" => "Exclude Pages From Navigation by ID (separate by ',')",
                "id" => $shortname."_exclude_page",
                "std" => "",
                "type" => "text"),
    			
        array(    "name" => "Exclude Categories From Navigation by ID (separate by ',')",
                "id" => $shortname."_exclude_cat",
                "std" => "",
                "type" => "text"),
    			
    	array(    "name" => "Sort Categorie Links by Name/ID",
                "id" => $shortname."_sort_cat",
                "type" => "select",
                "std" => "name",
                "options" => array("name", "ID")),
    			
    	array(    "name" => "Order Category Links by Ascending/Descending",
                "id" => $shortname."_order_cat",
                "type" => "select",
                "std" => "asc",
                "options" => array("asc", "desc")),
    						
    	array(    "name" => "Order Pages Links by Ascending/Descending",
                "id" => $shortname."_order_page",
                "type" => "select",
                "std" => "asc",
                "options" => array("asc", "desc")),
    			
        array(    "name" => "Advertisement Options",
                "type" => "titles"),
    			
    	array(    "name" => "Enable/Disable 125x125 Sidebar Ads",
                "id" => $shortname."_ads",
                "type" => "select",
                "std" => "Disable",
                "options" => array("Disable", "Enable")),
    			
    
    	array(    "name" => "Enable/Disable 468x60 Advertisement (on post pages)",
                "id" => $shortname."_foursixeight",
                "type" => "select",
                "std" => "Disable",
                "options" => array("Disable", "Enable")),
    		
        array(    "name" => "Banner Management",
                "type" => "titles"),
    			
    	array(    "name" => "468x60 Banner Image",
                "id" => $shortname."_banner_468",
                "std" => "http://www.elegantwordpressthemes.com/images/eGamer/468x60.gif",
                "type" => "text"),
    						
    	array(    "name" => "468x60 Banner URL",
                "id" => $shortname."_banner_468_url",
                "std" => "#",
                "type" => "text"),
    			
    	array(    "name" => "125x125 Banner #1 Image",
                "id" => $shortname."_banner_image_one",
                "std" => "http://www.elegantwordpressthemes.com/images/eGamer/125x125.gif",
                "type" => "text"),
    			
    	array(    "name" => "125x125 Banner #1 URL",
                "id" => $shortname."_banner_url_one",
                "std" => "#",
                "type" => "text"),
    			
    	array(    "name" => "125x125 Banner #2 Image",
                "id" => $shortname."_banner_image_two",
                "std" => "http://www.elegantwordpressthemes.com/images/eGamer/125x125.gif",
                "type" => "text"),
    			
    	array(    "name" => "125x125 Banner #2 URL",
                "id" => $shortname."_banner_url_two",
                "std" => "#",
                "type" => "text"),
    			
    	array(    "name" => "125x125 Banner #3 Image",
                "id" => $shortname."_banner_image_three",
                "std" => "http://www.elegantwordpressthemes.com/images/eGamer/125x125.gif",
                "type" => "text"),
    			
    	array(    "name" => "125x125 Banner #3 URL",
                "id" => $shortname."_banner_url_three",
                "std" => "#",
                "type" => "text"),
    		
    	array(    "name" => "125x125 Banner #4 Image",
                "id" => $shortname."_banner_image_four",
                "std" => "http://www.elegantwordpressthemes.com/images/eGamer/125x125.gif",
                "type" => "text"),
    			
    	array(    "name" => "125x125 Banner #4 URL",
                "id" => $shortname."_banner_url_four",
                "std" => "#",
                "type" => "text"),		
    );
    
    function mytheme_add_admin() {
    
        global $themename, $shortname, $options;
    
        if ( $_GET['page'] == basename(__FILE__) ) {
        
            if ( 'save' == $_REQUEST['action'] ) {
    
                    foreach ($options as $value) {
                        update_option( $value['id'], $_REQUEST[ $value['id'] ] ); }
    
                    foreach ($options as $value) {
                        if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ]  ); } else { delete_option( $value['id'] ); } }
    
                    header("Location: themes.php?page=functions.php&saved=true");
                    die;
    
            } else if( 'reset' == $_REQUEST['action'] ) {
    
                foreach ($options as $value) {
                    delete_option( $value['id'] ); }
    
                header("Location: themes.php?page=functions.php&reset=true");
                die;
    
            }
        }
    
        add_theme_page($themename." Options", "Current Theme Options", 'edit_themes', basename(__FILE__), 'mytheme_admin');
    
    }
    
    function mytheme_admin() {
    
        global $themename, $shortname, $options;
    
        if ( $_REQUEST['saved'] ) echo '<div id="message" class="updated fade"><p><strong>'.$themename.' settings saved.</strong></p></div>';
        if ( $_REQUEST['reset'] ) echo '<div id="message" class="updated fade"><p><strong>'.$themename.' settings reset.</strong></p></div>';
        
    ?>
    <div class="wrap">
    <h2><?php echo $themename; ?> settings</h2>
    
    <form method="post">
    
    
    
    <?php foreach ($options as $value) { 
        
    if ($value['type'] == "text") { ?>
    
    <div style="float: left; width: 880px; background-color:#E4F2FD; border-left: 1px solid #C2D6E6; border-right: 1px solid #C2D6E6;  border-bottom: 1px solid #C2D6E6; padding: 10px;">     
    <div style="width: 200px; float: left;"><?php echo $value['name']; ?></div>
    <div style="width: 680px; float: left;"><input name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" style="width: 400px;" type="<?php echo $value['type']; ?>" value="<?php if ( get_settings( $value['id'] ) != "") { echo get_settings( $value['id'] ); } else { echo $value['std']; } ?>" /></div>
    </div>
     
    <?php } elseif ($value['type'] == "text2") { ?>
            
    <div style="float: left; width: 880px; background-color:#E4F2FD; border-left: 1px solid #C2D6E6; border-right: 1px solid #C2D6E6;  border-bottom: 1px solid #C2D6E6; padding: 10px;">     
    <div style="width: 200px; float: left;"><?php echo $value['name']; ?></div>
    <div style="width: 680px; float: left;"><textarea name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" style="width: 400px; height: 200px;" type="<?php echo $value['type']; ?>"><?php if ( get_settings( $value['id'] ) != "") { echo get_settings( $value['id'] ); } else { echo $value['std']; } ?></textarea></div>
    </div>
    
    
    <?php } elseif ($value['type'] == "select") { ?>
    
    <div style="float: left; width: 880px; background-color:#E4F2FD; border-left: 1px solid #C2D6E6; border-right: 1px solid #C2D6E6;  border-bottom: 1px solid #C2D6E6; padding: 10px;">   
    <div style="width: 200px; float: left;"><?php echo $value['name']; ?></div>
    <div style="width: 680px; float: left;"><select name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" style="width: 400px;">
    <?php foreach ($value['options'] as $option) { ?>
    <option<?php if ( get_settings( $value['id'] ) == $option) { echo ' selected="selected"'; } elseif ($option == $value['std']) { echo ' selected="selected"'; } ?>><?php echo $option; ?></option>
    <?php } ?>
    </select></div>
    </div>
    
    <?php } elseif ($value['type'] == "titles") { ?>
    
    <div style="float: left; width: 870px; padding: 15px; background-color:#2583AD; border: 1px solid #2583AD; color: #FFF; font-size: 16px; font-weight: bold; margin-top: 25px;">   
    <?php echo $value['name']; ?>
    </div>
    
    <?php 
    } 
    }
    ?>
    
    <p class="submit">
    <input name="save" type="submit" value="Save changes" />    
    <input type="hidden" name="action" value="save" />
    </p>
    </form>
    <form method="post">
    <p class="submit">
    <input name="reset" type="submit" value="Reset" />
    <input type="hidden" name="action" value="reset" />
    </p>
    </form>
    
    <?php
    }
    
    function mytheme_wp_head() { ?>
    
    <?php }
    
    add_action('wp_head', 'mytheme_wp_head');
    add_action('admin_menu', 'mytheme_add_admin'); ?>
    <?php  
    $new_meta_boxes2 =  
    array(  
    "image" => array(  
    "name" => "rating",  
    "std" => "",  
    "title" => "Assign a Rating",  
    "description" => "Place the full path your your image here to have it displayed as a thumbnail")  
    );  
    function new_meta_boxes2() {  
    global $post, $new_meta_boxes2;  
    
    foreach($new_meta_boxes2 as $meta_box) {  
    $meta_box_value = get_post_meta($post->ID, $meta_box['name'].'_value', true);  
    
    if($meta_box_value == "")  
    $meta_box_value = $meta_box['std'];  
     
    echo'<input type="hidden" name="'.$meta_box['name'].'_noncename" id="'.$meta_box['name'].'_noncename" value="'.wp_create_nonce( plugin_basename(__FILE__) ).'" />';  
      
    echo'<h2>'.$meta_box['title'].'</h2>';  
      
    echo'<input type="text" name="'.$meta_box['name'].'_value" value="'.$meta_box_value.'" size="55" /><br />';  
     
    echo'<p><label for="'.$meta_box['name'].'_value">'.$meta_box['description'].'</label></p>';  
    }  
    }
    function create_meta_box2() {  
    global $theme_name;  
    if ( function_exists('add_meta_box') ) {  
    add_meta_box( 'new-meta-boxes2', 'eGamer Rating Settings', 'new_meta_boxes2', 'post', 'normal', 'high' );  
    }
    }
    function save_postdata2( $post_id ) {  
    global $post, $new_meta_boxes2;  
    
    foreach($new_meta_boxes2 as $meta_box) {  
    // Verify  
    if ( !wp_verify_nonce( $_POST[$meta_box['name'].'_noncename'], plugin_basename(__FILE__) )) {  
    return $post_id;  
    }  
    
    if ( 'page' == $_POST['post_type'] ) {  
    if ( !current_user_can( 'edit_page', $post_id ))  
    return $post_id;  
    } else {  
    if ( !current_user_can( 'edit_post', $post_id ))  
    return $post_id;  
    }  
      
    $data = $_POST[$meta_box['name'].'_value'];  
     
    if(get_post_meta($post_id, $meta_box['name'].'_value') == "")  
    add_post_meta($post_id, $meta_box['name'].'_value', $data, true);  
    elseif($data != get_post_meta($post_id, $meta_box['name'].'_value', true))  
    update_post_meta($post_id, $meta_box['name'].'_value', $data);  
    elseif($data == "")  
    delete_post_meta($post_id, $meta_box['name'].'_value', get_post_meta($post_id, $meta_box['name'].'_value', true));  
    }  
    }
    add_action('admin_menu', 'create_meta_box2');  
    add_action('save_post', 'save_postdata2');  
    ?>

  • 12-03-2009, 18:51:57
    #4
    Temanız nedir hangi temayı kullanıyorsunuz?

    Kullandıgınız tema mimbpro

    Bunda resim eklemek için ilk önce /scripts/cache/ klasörünün izinlerini 777 yapmalısınız ayrıca resim eklemek için girilen kod şu olmalı ( Image ) anahtar kısmınada resim linkini vermeniz gerekiyor
  • 12-03-2009, 19:25:49
    #5
    dostum onu kullanmıyor zaten problem resim eklemek değil. Ben kendi hostuma yüklemeden farklı yerden resim çekip onu class=thumbnail kısmında göstermek istiyorum.

    ilgin için teşekkür ederim.
  • 12-03-2009, 19:38:36
    #6
    Aynı sorun bendede vardı kafayı yemek üzereydim ama takmıştım kafaya illa magazin teması kuracaktım sonunda şu an kullandıgım temayı buldum hiç bir sorun yok
  • 13-03-2009, 00:29:28
    #7
    index.php(home.php varsa onu verin) ve functions demiştim ama sadece functions geldi ?
  • 13-03-2009, 10:04:56
    #8
    index.php

    <?php get_header(); ?>	
    
    <div id="container">
    	
    <div id="left-div">
    		
    <div id="left-inside">
    
     <?php if (get_option('artsee_format') == 'Blog Style') { ?>
    <?php include(TEMPLATEPATH . '/includes/blogstyle.php'); ?>
    <?php } else { include(TEMPLATEPATH . '/includes/defaultindex.php'); } ?>
    	
    </div>
    		
    </div>
    
    <?php get_sidebar(); ?>    
    <?php get_footer(); ?>   
    
    </body>
    </html>
    Blogstyle.php
     <?php if (have_posts()) : while (have_posts()) : the_post(); 
      if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>
    
    <!--Begin Post-->
    <span class="single-entry-titles" style="margin-top: 18px;"></span>
    <div class="post-wrapper">
    <div style="clear: both;"></div>
    <?php if (get_option('artsee_thumbnails') == 'Hide') { ?>
    <?php { echo ''; } ?>
    <?php } else { include(TEMPLATEPATH . '/includes/thumbnail.php'); } ?>
    <h3 class="post-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
    <div class="post-info">Ekleyen <?php the_author() ?> Kategori  <?php the_category(', ') ?> Tarih  <?php the_time('m jS, Y') ?> |  <a href="#postcomment" title="<?php _e("Yorum Yap"); ?>"><?php comments_number('Yorum Yok','1 yorum','% yorum'); ?></a></div>
    			
    
    <?php the_content(); ?>
    </div>
    <?php endwhile; ?>
    
    <!--End Post-->
    
    
    <div style="clear: both;"></div>
    
    <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } 
    else { ?>
    <p class="pagination"><?php next_posts_link('&laquo; eski oyunlar') ?> <?php previous_posts_link('yeni oyunlar &raquo;') ?></p>
    <?php } ?>
    
    <?php else : ?>
    
    <h2 >Oyun bulunamadı.</h2>
    
    <p>Malesef aradığın kelimeyle alakalı hiç oyuk yok. </p>
    
    <?php endif; ?>

    Defaultindex.php
    <?php if (have_posts()) : while (have_posts()) : the_post(); 
      if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>
    
    		<?php 
    		// check for thumbnail
    $thumb = get_post_meta($post->ID, 'image_value', $single = true);
    // check for thumbnail class
    $thumb_class = get_post_meta($post->ID, 'image_value Class', $single = true);
    // check for thumbnail alt text
    $thumb_alt = get_post_meta($post->ID, 'image_value Alt', $single = true);
    				 ?>
    <div class="home-post-wrap2">
    <span class="single-entry-titles"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title2('', '', true, '400') ?></a></span>
    <div class="single-entry">
    <?php // if there's a thumbnail
    if($thumb !== '') { ?>
    <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><img src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php echo $thumb; ?>&amp;h=120&amp;w=120&amp;zc=1" class="thumbnail" alt="<?php if($thumb_alt !== '') { echo $thumb_alt; } else { echo the_title(); } ?>"  style="border: none;" /></a>
    <?php } // end if statement
    // if there's not a thumbnail
    else { echo ''; } ?>
    <div class="post-info">Ekleyen <?php the_author() ?> Kategori  <?php the_category(', ') ?> Tarih  <?php the_time('m jS, Y') ?> |  <?php comments_popup_link('Yorum yok', '1 Yorum', '% Yorum'); ?></div>
    <?php the_content_limit(300, ""); ?>
    <a href="<?php the_permalink() ?>" rel="bookmark" style="float: right;" title="<?php the_title(); ?>"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/readmore.gif" alt="oyunu oyna <?php the_title(); ?>" style="border: none;" /></a>
    </div>
    </div>
    
    
    <?php endwhile; ?>
    
    <div style="clear: both;"></div>
    
    <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } 
    else { ?>
    <p class="pagination"><?php next_posts_link('&laquo; eski oyunlar') ?> <?php previous_posts_link('yeni oyunlar &raquo;') ?></p>
    <?php } ?>
    
    <?php else : ?>
    
    <h2 >Oyun Bulunamadı</h2>
    
    <p>bulamadım oyunu.. </p>
    
    <?php endif; ?>