の関数から呼び出された場合、PHP getimagesize が機能しませんfunction.php
。
関数.php:
<?php
// Theme Options
require_once(TEMPLATEPATH . '/functions/admin-menu.php');
add_action('wp_head', 'theme_options', 'get_image_size');
function theme_options() {
// Initiate Theme Options
$options = get_option('plugin_options');
// If a logo image was uploaded then remove text from site title
if ($options['logo'] != NULL)
$remove_text = '-9999px';
else
$remove_text = 0;
?><style>
body {
background-color: <?php echo $options['color_scheme']; ?>
}
#header h1 a {
background: url(<?php echo $options['logo']; ?>) no-repeat scroll 0 0;
text-indent: <?php echo $remove_text; ?>;
}
</style><?php
}
function get_image_size() {
list($width, $height, $type, $attr) = getimagesize($options['logo']);
echo "Image width " .$width;
echo "<BR>";
echo "Image height " .$height;
echo "<BR>";
var_dump($width);
var_dump($heigt);
}
$options['logo']
が戻ってきhttp://localhost/wordpress/wp-content/uploads/2010/12/logo4.png
たので画像を表示しています。
私もそうvar_dump
しましたが$width
、$height
彼らは現れませんでした。
助言がありますか?
編集: の完全なコードを貼り付けましたfunctions.php
。 $options['logo']
関数で完全にtheme_option
機能するので、関数で機能しない理由がわかりませんget_image_size
。