رفتن به مطلب

تغییر اندازه تصاویر


پست های پیشنهاد شده

سلام

پوسته من چهار استایل برای نمایش تصاویر داره (Small(200*200) - Medium(280*320) - Large(440*220) - Full (920*x

حالا وقتی از استایل full استفاده می کنم اندازه کوچکتر عکس رو ریسایز میکنه که full بشه یعنی به جای اینکه از اندازه اصلی واسه ریسایز کردن اسفاده کنه از اندازه کوچکتر (580*386) استفاده میکنه که همین باعث میشه کیفیت عکس خیلی پایین بیاد

دقیق نمیدونم باید از کدوم فایل پوسته مشکل رو برطرف کنم اما فایل theme-functions.php که مشکوک هستش :دی رو میزام

لطفا راهنمایی کنید.

ممنون

<?php

function post_is_in_descendant_category( $cats, $_post = null ){

foreach ( (array) $cats as $cat ) {

// get_term_children() accepts integer ID only

$descendants = get_term_children( (int) $cat, 'category');

if ( $descendants && in_category( $descendants, $_post ) )

return true;

}

return false;

}

function exposure_thumb_url($url,$width = 200, $height = null){

$src = get_bloginfo('template_url') . '/thumb.php?src=' . $url . '&w=' .$width . '&h=' . $height . '&zc=1&q=90';

return $src ;

}

function exposure_attachments($instance = null,$args = array()){

extract( $args );

// print_r($args);

// print_r($instance);

$post_id = $instance['post_id'];

$post_id_select = $instance['post_id_select'];

$cat_id = $instance['cat_id'];

$widget_title = $instance['title'];

$image_title = $instance['image_title'];

$image_caption = $instance['image_caption'];

$size = $instance['size'];

$rows = $instance['rows'];

$max = $instance['max'];

$l2p = $instance['l2p'];

$lb = $instance['lb'];

$auto = $instance['auto'];

$speed = $instance['speed'];

$wp_resized_image = get_option('woo_wp_attachment');

$slider_id = $args['widget_id'];

if($slider_id == ''){ $slider_id = $post_id; }

if(!is_home()){

$custom_size = get_post_meta($post_id,'thumbsize',true);

$custom_title = get_post_meta($post_id,'title',true);

$custom_caption = get_post_meta($post_id,'caption',true);

$custom_rows = get_post_meta($post_id,'rows',true);

$custom_lb = get_post_meta($post_id,'lb',true);

}

if($custom_size != 'default' AND !empty($custom_size)) {$size = $custom_size;}

if($custom_title != 'default' AND !empty($custom_size)) {$image_title = $custom_title;}

if($custom_caption != 'default' AND !empty($custom_size)) {$image_caption = $custom_caption;}

if($custom_rows != 'default' AND !empty($custom_rows)) {$rows = $custom_rows;}

if($custom_lb != 'default' AND !empty($custom_lb)) {$lb = $custom_lb;}

$auto = intval($auto); // Validate int

$speed = intval($speed); // Validate int

$rows = intval($rows); // Validate int

//Get the attachments for the Category posts.

if(!empty($cat_id)){

$category = true;

//$post_id = str_replace(' ','-',strtolower(get_cat_name($cat_id)));

$cat_data = get_category($cat_id, ARRAY_A);

$post_id = $cat_data['slug'];

}

if($category == true){

$posts = get_posts('cat='.$cat_id .'&numberposts=' . $max);

$cat_counter = 0;

$attachments = array();

foreach($posts as $post){

//print_r($posts);

$cat_counter++;

$single_attachment = get_children( array(

'post_parent' => $post->ID,

'post_status' => 'inherit',

'post_type' => 'attachment',

'post_mime_type' => 'image',

'order' => 'ASC',

'orderby' => 'menu_order date',

'numberposts' => 1,

));

if(!empty($single_attachment)){

if($cat_counter == 1){

$attachments = $single_attachment;

}else{

$attachments = array_merge($attachments, $single_attachment);

}

}

}

}

else {

if($max == "") { $max = 999;}

$attachments = get_children( array(

'post_parent' => $post_id,

'post_status' => 'inherit',

'post_type' => 'attachment',

'post_mime_type' => 'image',

'order' => 'ASC',

'orderby' => 'menu_order date',

'numberposts' => $max,

));

}

$items = count($attachments);

//Slider

if($rows > 0) { $slider = true;}

if($slider == true){

if($size == 'small'){ $viewable = 4 * $rows; }

if($size == 'medium'){ $viewable = 3 * $rows; }

if($size == 'large'){ $viewable = 2 * $rows; }

if($size == 'full'){ $viewable = 1 * $rows; }

}

if($viewable >= $items) {$slider = false;}

//Lightbox

if ($lb == 'true' OR $lb == 'on'){$lightbox = true;}

else {$lightbox = false;}

//Link 2 Post

if ($l2p == 'true' OR $l2p == 'on'){$link_to_post = true;}

else {$link_to_post = false;}

$counter = 3;

$iter = 0;

$loop = 0;

if(empty($attachments)){

return false; // Bail is there is no attachments

}

$items = count($attachments);

foreach ( $attachments as $attachment ) {

$counter++;

$loop++;

//print_r($attachment);

$id = $attachment->ID;

//Image Setup

if($link_to_post == 'true') {

$link = get_permalink($attachment->post_parent);

} else {

$link = get_attachment_link($id);

}

$src = wp_get_attachment_image_src($id, 'large', true); // Thumb.php makes use of the Largest wordpres image and not the source file.

//print_r($src);

$full_image = $src[0];

//Content Setup

$att_title = $attachment->post_title;

$att_caption = $attachment->post_excerpt;

$att_content = $attachment->post_content;

$att_comments = $attachment->comment_count;

//Setup what goes where

if($image_title == 'off'){$title = '';}

elseif($image_title == 'title'){$title = $att_title;}

elseif ($image_title == 'caption'){$title = $att_caption;}

elseif ($image_title == 'description'){$title = $att_content;}

if($image_caption == 'off'){$content = '';}

elseif($image_caption == 'title'){$content = $att_title;}

elseif ($image_caption == 'caption'){$content = $att_caption;}

elseif ($image_caption == 'description'){$content = $att_content;}

//Size

if($size == 'small'){$w = 200; $h = 200; $l = 7; $per_row = 4;}

elseif($size == 'medium'){$w = 280; $h = 320; $l = 6; $per_row = 3;}

elseif($size == 'large'){$w = 440; $h = 220; $l = 5; $per_row = 2;}

elseif($size == 'full'){$w = 920; $h = 0; $l = 4; $per_row = 1;}

//MOD

if($l == 4) {$mod = ' full first last';}

else {

if($counter%4 == 0)

{$mod = ' first';}

elseif($counter%$l == 0)

{$mod = ' last';}

else{$mod = '';};

if($counter == $l) $counter = 3;

}

if(($iter == 0 ) && $slider == true){$images .= '<div class="slide">' . "\n";}// Slider wrap

$iter++;

$img_url = exposure_thumb_url($full_image,$w,$h);

if($size == 'full' AND $wp_resized_image == 'true'){ $img_url = $full_image;}

$images .= '<div class="image_box'. $mod .'">' . "\n";

if($lightbox == false AND $att_comments != 0) $images .= '<span class="date"><a href="'.$link.'">'. $att_comments . '</a></span>' . "\n";

if(($image_title == 'off' AND $image_caption == 'off') OR ($title == '' AND $content == '')){

//When there is no content for image caption or both is turned off

}

else{

$images .= '<div class="text">' . "\n";

if($image_title != 'off')

{

if($lightbox) {

//$images .= '<h2><a title="'. $title .'" href="'. $link .'">'. $title .'</a></h2>' . "\n";

$images .= '<h3><a title="'. $title .'" rel="lightbox['.$post_id.']" href="'. $full_image .'">'. $title .'</a></h3>'. "\n";;

} else {

$images .= '<h3><a title="'. $title .'" href="'. $link .'">'. $title .'</a></h3>' . "\n";

}

}

if($image_caption != 'off') {

if($lightbox) {

$images .= '<p><a title="'. $content .'" rel="lightbox['.$post_id.']" href="'. $full_image .'">'. $content .'</a></p>' . "\n";

} else {

$images .= '<p><a title="'. $content .'" href="'. $link .'">'. $content .'</a></p>' . "\n";

}

}

$images .= '</div>' . "\n";

}

if($lightbox){

$images .= '<a title="' . get_the_title($id) .'" rel="lightbox['.$post_id.']" href="'. $full_image /* Max upload size in WP? OR Thumb.php? -> exposure_thumb_url($full_image,920,0) */ .'"><img src="'. $img_url .'" width="'.$w.'" alt="'.get_the_title($id).'" /></a>';

} else {

$images .= '<a href="'. $link .'"><img width="'.$w.'" src="'. $img_url .'" alt="'.get_the_title($id).'" /></a>';

}

$images .= '</div>' . "\n";

if(($iter == $viewable || $loop == $items ) && $slider == true){$images .= '</div>'; $iter = 0;}// Slider wrap

}

//Start Output building

$output = '';

$output .= '<div class="picture_widget">';

//Heading

$output .= '<div class="heading">';

if($widget_title == '' AND $category == false) { $widget_title = get_the_title($post_id);}

//else { $widget_title = get_the_title($post_id);}

if($category == true AND $widget_title == ''){

$output .= '<h2><a href="'. get_category_link($cat_id).'">'. get_cat_name($cat_id) .'</a></h2>';

}

elseif ($widget_title != '' AND $category == true){

$output .= '<h2><a href="'. get_category_link($cat_id).'">'. $widget_title .'</a></h2>';

}

elseif (!is_single() && !is_page()){

$output .= '<h2><a href="'. get_permalink($post_id).'">'. $widget_title .'</a></h2>';

}

else {

$output .= '<h2>'. $widget_title .'</h2>';

}

//$output .= '<a href="#" title="#" class="title_rss">RSS feed (optional)</a>'; ?

$output .= '<div class="clear"></div>';

$output .= '</div>' . "\n";

if($slider == true){

$output .= '<div id="slider_'. $slider_id .'">'. "\n" . '<div class="container">'. "\n" . '<div class="slides">'. "\n";

}

//Images

$output .= $images;

if($slider == true){

$output .= "</div>\n</div>\n";

$output .= '<a class="slider_left previous" href="#" title="Navigate left">PREV</a>';

$output .= '<a class="slider_right next" href="#" title="Navigate right">NEXT</a>' . "\n";

$output .= "</div>\n";

}

$output .= '<div class="clear"></div>' . "\n";

//Category Archives

if($category != true AND !is_page()) {

$cats = get_the_category($post_id);

foreach($cats as $category){

$output .= '<a class="archive_link" href="'. get_category_link($category->term_id) .'" title="View '.$category->name .' Archives">' . $category->name . '</a>';

}

$output .= '<div class="clear"></div>' . "\n";

}

if($slider == true){

$output .= '<script type="text/javascript">jQuery(window).load(function(){ jQuery("#slider_'. $slider_id . '").loopedSlider({autoStart:'.$auto.', slidespeed:'.$speed.'});});</script>'; // Init slider wth inline JS

}

$output .= '</div>';

return $output;

}

?>

ویرایش شده توسط NESTED
لینک به ارسال

سلام

توی این کد چیز خاصی ندیدم.

آدرسی از اون صفحه که عکس کم کیفیت میشه بزارید تا شاید بتونیم براساس تگهای html به جایی برسیم.

لینک به ارسال

مثلا این عکس رو ببینید به جای اینکه از این نسخه برای ریسایز استفاده کنه از این نسخه استفاده کرده که کیفیت اومده پایین

لینک به ارسال

شما فایل single تون رو پیوست کنید. (فشرده شده)

فکر نکنم مشکل از این فایل باشه چون همه صفحات این مشکل رو داره

single.zip

لینک به ارسال

برای بررسی نحوه ایجاد اندازه ها میخواستم که دیدم کلا داره هوک میکنه.

این پوسته سری سایت Woo هست. رایگان هست یا پرمیوم؟ چون هرگونه بحث در مورد پوسته های پرمیوم در انجمن ممنوعهست.

اگر رایگان هست اسمش رو بگید تا بتونیم پوسته رو بگیریم و تستش کنیم.

لینک به ارسال

برای بررسی نحوه ایجاد اندازه ها میخواستم که دیدم کلا داره هوک میکنه.

این پوسته سری سایت Woo هست. رایگان هست یا پرمیوم؟ چون هرگونه بحث در مورد پوسته های پرمیوم در انجمن ممنوعهست.

اگر رایگان هست اسمش رو بگید تا بتونیم پوسته رو بگیریم و تستش کنیم.

پرمیوم هستش :)

فقط یه سوال

جایگزینی برای فایل timthumb هستش؟ Timthumb مشکل امنیتی داره

لینک به ارسال

پرمیوم هستش :)

فقط یه سوال

جایگزینی برای فایل timthumb هستش؟ Timthumb مشکل امنیتی داره

معمولن پوسته های woo با استفاده از فانکشن اندازه هارو تنظیم میکنن تا در single نمایش داده بشه

شما فایل فانکشن رو بررسی کنید و اندازه هارو تغییر بدید

لینک به ارسال

متاسفانه پوسته های پرمیوم بحثش در انجمن ممنوع هست.

موفق باشید

لینک به ارسال

به گفتگو بپیوندید

هم اکنون می توانید مطلب خود را ارسال نمایید و بعداً ثبت نام کنید. اگر حساب کاربری دارید، برای ارسال با حساب کاربری خود اکنون وارد شوید .

مهمان
ارسال پاسخ به این موضوع ...

×   شما در حال چسباندن محتوایی با قالب بندی هستید.   حذف قالب بندی

  تنها استفاده از 75 اموجی مجاز می باشد.

×   لینک شما به صورت اتوماتیک جای گذاری شد.   نمایش به صورت لینک

×   محتوای قبلی شما بازگردانی شد.   پاک کردن محتوای ویرایشگر

×   شما مستقیما نمی توانید تصویر خود را قرار دهید. یا آن را اینجا بارگذاری کنید یا از یک URL قرار دهید.

×
×
  • اضافه کردن...