Un Evento Unico. 5 Sale. 27 Interventi. SEO, SOCIAL, E-Commerce, Mobile, Turismo.
CLICCA QUI e SCOPRI DI PIù X Chiudi
 
Forum GT: Condividiamo idee e conoscenza Forum GT: Condividiamo idee e conoscenza


Condividi questo contenuto nei Social Network:
Ti stiamo aspettando: Registrati subito e gratis. Entra a far parte di una delle comunità più attive in Italia. Se hai dimenticato i tuoi dati li puoi recuperare subito.


Vai indietro   Forum per Webmaster: Condividiamo Idee e Conoscenza > Cms > Wordpress
Benvenuto! Forum Regole FAQ Lista utenti Calendario Segna come letti


Rispondi
 
LinkBack Strumenti di discussione
Vecchio 12-01-12, 18:29   #1 (permalink)
User
 
L'avatar di DARKF3D3
 
Data di registrazione: Nov 2009
Messaggi: 221
Ridurre dimensioni immagini mostrate da plugin

Ho la necessità di modificare il plugin "randomimage".
Il suddetto plugin visualizza nella sidebar 12 immagini prelevate a random tra tutte le immagini pubblicate sul blog.
Il problema è che questo plug in non ridimensiona le immagini, ma semplicemente al momento della visualizzazione modifica le dimensioni cambiando l'attributo width dell'img src.
Con la conseguenza che ogni volta vengono visualizzate immagini di dimensioni inferiori ai 100px che però pesano anche più di 100Kb-150Kb l'una.

Sapreste aiutarmi a far si che il plugin diminuisca la dimensione dell'immagine?

Questo è il codice:
Codice PHP:
<?php

/*
Plugin Name: Random Image
Description: Display a random image that links back to the post it came from.
Version: 5.0
Author: Justin Watt
*/

// widgetization
function widget_randomimage_init() {
  if (!
function_exists('register_sidebar_widget')) {
        return;
    }

    function 
widget_randomimage() {
        print 
'<li>' "\n";
        
randomimage();
        print 
'</li>' "\n";
    }

    
register_sidebar_widget('Random Image''widget_randomimage');
}

add_action('plugins_loaded''widget_randomimage_init');


// add configuration page to WordPress
function randomimage_add_page()
{
  
add_options_page('Random Image''Random Image'6__FILE__'randomimage_configuration_page');
}
add_action('admin_menu''randomimage_add_page');


// helper function to set randomimage defaults (if necessary)
// and return array of options
function get_randomimage_options()
{
  
$randomimage_options get_option('randomimage_options');

  if (!isset(
$randomimage_options["image_template_html"]) || $randomimage_options["image_template_html"] == '') {

    if (isset(
$randomimage_options["show_post_title"]) || isset($randomimage_options["show_alt_caption"])) {
      
// lets upgrade from v3
      
$upgraded_template '';
      if (
$randomimage_options["show_post_title"] === true) {
        
$upgraded_template .= "\n<strong>%1</strong><br />\n";
      }

      
$upgraded_template .= "%2";

      if (
$randomimage_options["show_alt_caption"] === true) {
        
$upgraded_template .= "<br />\n<em>%3</em>\n";
      }

      
$randomimage_options["image_template_html"] = $upgraded_template;
      
      unset(
$randomimage_options["show_post_title"]);
      unset(
$randomimage_options["show_alt_caption"]);

    } else {
      
$randomimage_options["image_template_html"] = "\n<strong>%1</strong><br />\n%2<br />\n<em>%3</em>\n";
    }
  }

  
// init default options if options aren't set    
  
if (!isset($randomimage_options["show_images_in_posts"])) {
    
$randomimage_options["show_images_in_posts"] = true;
  }
  
  if (!isset(
$randomimage_options["show_images_in_pages"])) {
    
$randomimage_options["show_images_in_pages"] = false;
  }

  if (!isset(
$randomimage_options["show_images_in_galleries"])) {
    
$randomimage_options["show_images_in_galleries"] = true;
  }
  
  if (!isset(
$randomimage_options["number_of_images"])) {
    
$randomimage_options["number_of_images"] = 1;
  }
  
  if (!isset(
$randomimage_options["image_attributes"])) {
    
$randomimage_options["image_attributes"] = "";
  }
  
  if (!isset(
$randomimage_options["inter_image_html"])) {
    
$randomimage_options["inter_image_html"] = "<br /><br />";
  }
  
  if (!isset(
$randomimage_options["image_src_regex"])) {
    
$randomimage_options["image_src_regex"] = "";
  }

  if (!isset(
$randomimage_options["category_filter"])) {
    
$randomimage_options["category_filter"] = array();
  }

  if (!isset(
$randomimage_options["sort_images_randomly"])) {
    
$randomimage_options["sort_images_randomly"] = true;
  }

  if (!isset(
$randomimage_options["image_class_match"])) {
    
$randomimage_options["image_class_match"] = "";
  } 

  
add_option('randomimage_options'$randomimage_options);
  return 
$randomimage_options;
}


// generate configuration page
function randomimage_configuration_page()
{
  
$randomimage_options get_randomimage_options();
  
  
// if form has been submitted, save values
  
if (isset($_POST['submit'])) {
    
// booleanize all the checkboxes
    
isset($_POST['show_images_in_posts'])     ? $_POST['show_images_in_posts']     = true $_POST['show_images_in_posts']     = false;
    isset(
$_POST['show_images_in_pages'])     ? $_POST['show_images_in_pages']     = true $_POST['show_images_in_pages']     = false;
    isset(
$_POST['show_images_in_galleries']) ? $_POST['show_images_in_galleries'] = true $_POST['show_images_in_galleries'] = false;
    isset(
$_POST['sort_images_randomly'])     ? $_POST['sort_images_randomly']     = true $_POST['sort_images_randomly']     = false;
    
    
// correct for empty image number
    
if ($_POST['number_of_images'] < 1) {
      
$_POST['number_of_images'] = 1;
    }

    
// correct for posts and pages and galleries being deselected
    
if (!$_POST['show_images_in_posts'] && !$_POST['show_images_in_pages']) {
      
$_POST['show_images_in_posts'] = true;
    }

    if (!
is_array($_POST['category_filter'])) {
      
$_POST['category_filter'] = array();
    }

    if (
trim($_POST['image_template_html']) == '') {
      
$_POST['image_template_html'] = "\n<strong>%1</strong><br />\n%2<br />\n<em>%3</em>\n";
    }

    
// create array of new options
    
$randomimage_options = array(
        
"show_images_in_posts"     => $_POST['show_images_in_posts'],
        
"show_images_in_pages"     => $_POST['show_images_in_pages'],
        
"show_images_in_galleries" => $_POST['show_images_in_galleries'],
        
"number_of_images"         => $_POST['number_of_images'],
        
"image_attributes"         => stripslashes($_POST['image_attributes']),
        
"inter_image_html"         => stripslashes($_POST['inter_image_html']),
        
"image_src_regex"          => stripslashes($_POST['image_src_regex']),
        
"category_filter"          => $_POST['category_filter'],
        
"sort_images_randomly"     => $_POST['sort_images_randomly'],
        
"image_class_match"        => stripslashes(trim($_POST['image_class_match'])),
        
"image_template_html"      => stripslashes($_POST['image_template_html'])
    );
    
update_option('randomimage_options'$randomimage_options);
  }

?>

<div class="wrap">
<h2>Random Image Settings</h2>

<form method="post" action="">

<p><strong>Instructions:</strong> Use the following options to configure how you want the plugin to behave. The Sample Output at the bottom of the page will reflect the changes you've made. When you're satisfied, goto <a href="widgets.php">Design > Widgets</a> and add "Random Image" to your sidebar (if your theme is widget-enabled). Otherwise you can manually edit your index.php or sidebar.php template files and add <code style="font-weight:bold;">&lt?php randomimage(); ?&gt</code> where you want the random image to appear.

<div style="clear: both;padding-top:10px;">
<label style="float:left;width:250px;text-align:right;padding-right:6px;" for="show_images_in_posts">Include images from posts?</label>
<div style="float:left;"><input type="checkbox" id="show_images_in_posts" name="show_images_in_posts" <?php if ($randomimage_options["show_images_in_posts"]) print "checked='on'"?>/>&nbsp;&nbsp;<label for="show_images_in_pages">Pages?</label> <input type="checkbox" id="show_images_in_pages" name="show_images_in_pages" <?php if ($randomimage_options["show_images_in_pages"]) print "checked='on'"?>/><br /></div>
</div>

<div style="clear: both;padding-top:10px;">
<label style="float:left;width:250px;text-align:right;padding-right:6px;" for="show_images_in_galleries">Include images from galleries?</label> 
<div style="float:left;"><input type="checkbox" id="show_images_in_galleries" name="show_images_in_galleries" <?php if ($randomimage_options["show_images_in_galleries"]) print "checked='on'"?>/><br /></div>
</div>

<div style="clear: both;padding-top:10px;">
<label style="float:left;width:250px;text-align:right;padding-right:6px;" for="sort_images_randomly">Sort Images Randomly?</label>
<div style="float:left;"><input type="checkbox" id="sort_images_randomly" name="sort_images_randomly" <?php if ($randomimage_options["sort_images_randomly"]) print "checked='on'"?>/> Uncheck if you want to show recent images rather than random images<br /></div>
</div>

<div style="clear: both;padding-top:10px;">
<label style="float:left;width:250px;text-align:right;padding-right:6px;padding-top:7px;" for="number_of_images">How many images to display?</label>
<div style="float:left;"><input type="text" id="number_of_images" name="number_of_images" size="1" maxlength="2" <?php if ($randomimage_options["number_of_images"]) print "value='" $randomimage_options["number_of_images"] . "'"?>/></div>
</div>

<div style="clear: both;padding-top:10px;">
<label style="float:left;width:250px;text-align:right;padding-right:6px;padding-top:7px;" for="image_template_html">HTML Template:<br/><code>%1</code> = title<br /><code>%2</code> = image<br /><code>%3</code> = caption<br /><code>%4</code> = excerpt</label>
<div style="float:left;"><textarea id="image_template_html" name="image_template_html" rows="4" cols="24" style="float:left;"><?php if ($randomimage_options["image_template_html"]) print stripslashes(htmlspecialchars($randomimage_options["image_template_html"])); ?></textarea>
e.g. <code style="font-weight:bold;">&lt;strong&gt;%1&lt;/strong&gt;&lt;br /&gt;<br />%2&lt;br /&gt;<br />&lt;em&gt;%3&lt;/em&gt;<code></div>
</div>

<div style="clear: both;padding-top:10px;">
<label style="float:left;width:250px;text-align:right;padding-right:6px;padding-top:7px;" for="inter_image_html">HTML between images:</label>
<div style="float:left;"><input type="text" id="inter_image_html" name="inter_image_html" size="12" <?php if (isset($randomimage_options["inter_image_html"])) print "value='" stripslashes(htmlspecialchars($randomimage_options["inter_image_html"], ENT_QUOTES)) . "'"?>/>  e.g. <code style="font-weight:bold;">&lt;br /&gt;&lt;br /&gt;</code></div>
</div>

<div style="clear: both;padding-top:10px;">
<label style="float:left;width:250px;text-align:right;padding-right:6px;padding-top:7px;" for="image_attributes">Optional attributes for <code>&lt;img&gt;</code> tags:</label>
<div style="float:left;"><input type="text" id="image_attributes" name="image_attributes"  style="width:200px;" <?php if ($randomimage_options["image_attributes"]) print "value='" stripslashes(htmlspecialchars($randomimage_options["image_attributes"], ENT_QUOTES)) . "'"?>/> e.g. <code style="font-weight:bold;">style="width:200px;"</code></div>
</div>

<div style="clear: both;padding-top:10px;">
<label style="float:left;width:250px;text-align:right;padding-right:6px;padding-top:7px;">Limit by categories/tags:<br />(leave unchecked for all)</label>
<div style="float:left;">

<div style='overflow:auto;height:6em;width:200px;background-color:#efefef;border:1px solid #b2b2b2;padding:2px 0 0 3px;'>
<?php
    
    
  
// create WordPress-style category multi-select list
  
global $wpdb$wp_version;

  if (
$wp_version >= '2.3') {
    
$categories $wpdb->get_results("SELECT $wpdb->terms.term_id as cat_ID, $wpdb->terms.name as cat_name
                                      FROM $wpdb->terms LEFT JOIN $wpdb->term_taxonomy on $wpdb->terms.term_id = $wpdb->term_taxonomy.term_id
                                      WHERE $wpdb->term_taxonomy.taxonomy IN ('post_tag', 'category')
                                      ORDER BY $wpdb->terms.name"
);
  } else  { 
    
$categories $wpdb->get_results("SELECT cat_ID, cat_name
                                      FROM $wpdb->categories
                                      ORDER BY cat_name"
);
  }

  foreach (
$categories as $category) {
    print 
"<label style='display:block;' for='category-$category->cat_ID'><input type='checkbox' value='$category->cat_ID' name='category_filter[]' id='category-$category->cat_ID'" . (in_array$category->cat_ID$randomimage_options["category_filter"] ) ? ' checked="checked"' "") . " />" .  wp_specialchars($category->cat_name) . "</label>\n";
  }
?>
</div>

</div>
</div>

<div style="clear: both;padding-top:10px;">
<label style="float:left;width:250px;text-align:right;padding-right:6px;padding-top:7px;" for="image_class_match">String to match in the <code>&lt;img&gt;</code> <code>class</code>:</label>
<div style="float:left;"><input type="text" id="image_class_match" name="image_class_match" style="width:200px;" <?php if ($randomimage_options["image_class_match"]) print "value='" stripslashes(htmlspecialchars($randomimage_options["image_class_match"], ENT_QUOTES)) . "'"?>/> e.g. <code style="font-weight:bold;">randomimage</code></div>
</div>


<div style="clear: both;padding-top:10px;">
<label style="float:left;width:250px;text-align:right;padding-right:6px;padding-top:7px;" for="image_src_regex">Regex to match against the <code>&lt;img&gt;</code> <code>src</code>:</label>
<div style="float:left;"><input type="text" id="image_src_regex" name="image_src_regex" style="width:200px;" <?php if ($randomimage_options["image_src_regex"]) print "value='" stripslashes(htmlspecialchars($randomimage_options["image_src_regex"], ENT_QUOTES)) . "'"?>/> e.g. <code style="font-weight:bold;">images</code></div>
</div>

<div style="clear: both;padding-top:10px;text-align:center;">
<p class="submit"><input type="submit" name="submit" value="Update Options &raquo;" /></p>
</div>
</form>
</div>


<div class="wrap">
<h2>Sample Output</h2>
<?php randomimage(); ?>
</div>




<?php
}



function 
randomimage($show_post_title          true
                     
$number_of_images         1
                     
$image_attributes         ""
                     
$show_alt_caption         true
                     
$image_src_regex          "",
                     
$post_type                "posts",
                     
$inter_image_html         "<br /><br />",
                     
$category_filter          "",
                     
$sort_images_randomly     true,
                     
$image_class_match        "",
                     
$image_template_html      "",
                     
$show_images_in_galleries true)
{
  
// get access to wordpress' database object
  
global $wpdb$wp_version;
  
$debugging false;

  if (
$debuggingprint "<strong>Random Image Debugging is On!</strong><br/>";

  
// if no arguments are specified
  // assume we're going with the configuration options
  
if (!func_get_args()) {
    if (
$debuggingprint "Configuration options (specified via admin interface):<br />";

    
$randomimage_options get_randomimage_options();

    
$number_of_images         $randomimage_options['number_of_images'];        
    
$image_attributes         $randomimage_options['image_attributes'];        
    
$image_src_regex          $randomimage_options['image_src_regex'];        
    
$inter_image_html         $randomimage_options['inter_image_html'];
    
$sort_images_randomly     $randomimage_options['sort_images_randomly'];
    
$image_class_match        $randomimage_options['image_class_match'];
    
$image_template_html      $randomimage_options['image_template_html'];
    
$show_images_in_galleries $randomimage_options['show_images_in_galleries'];

    
// convert category filter array into a comma-separated list
    
if (!is_array($randomimage_options['category_filter'])) {
      
$randomimage_options['category_filter'] = array();
    }
    
$category_filter  implode(","$randomimage_options['category_filter']);
    
    
// galleries really only exist in posts
    
if ($show_images_in_posts == true && $show_images_in_pages == false) {
      
$post_type "posts";
    
    } elseif (
$show_images_in_posts == false && $show_images_in_pages == true) {
      
$post_type "pages";

    } else {
      
$post_type "both";
    }

  } else {
    if (
$debuggingprint "Configuration options (specified via function parameters):<br />";
    
    
// if config options were specified via a function call, but no template was supplied,
    // build a template from the show_post_title and show_alt_caption options.
    
if ($image_template_html == '') {
      if (
$show_post_title) {
        
$image_template_html .= "\n<strong>%1</strong><br />\n";
      }

      
$image_template_html .= "%2";

      if (
$show_alt_caption) {
        
$image_template_html .= "<br />\n<em>%3</em>\n";
      }
    }
  }
  
  if (
$debugging) {
    print 
"show_post_title: "      htmlspecialchars($show_post_title)      . "<br/>";     
    print 
"number_of_images: "     htmlspecialchars($number_of_images)     . "<br/>";    
    print 
"image_attributes: "     htmlspecialchars($image_attributes)     . "<br/>";    
    print 
"show_alt_caption: "     htmlspecialchars($show_alt_caption)     . "<br/>";    
    print 
"image_src_regex:  "     htmlspecialchars($image_src_regex)      . "<br/>";     
    print 
"post_type: "            htmlspecialchars($post_type)            . "<br/>";           
    print 
"inter_image_html: "     htmlspecialchars($inter_image_html)     . "<br/>";    
    print 
"category_filter: "      htmlspecialchars($category_filter)      . "<br/>";     
    print 
"sort_images_randomly: " htmlspecialchars($sort_images_randomly) . "<br/><br/>";
  }

  
// select the post_type sql for both post pages (post_status = 'static') 
  // and posts (AND post_status = 'publish')
  // or for just pages or for just posts (the default)
  // by adding this where criteria, we also solve the problem
  // of accidentally including images from draft posts.
  
if ($wp_version '2.1') {
    if (
$post_type == "both") {
      
$post_type_sql "AND (post_status = 'publish' OR post_status = 'static')";
    } else if (
$post_type == "pages") {
      
$post_type_sql "AND post_status = 'static'";
    } else {
      
$post_type_sql "AND post_status = 'publish'";
    }

  } else {
    if (
$post_type == 'both') {
      
$post_type_sql "AND post_status = 'publish' AND post_type in ('post', 'page')";
    } elseif (
$post_type == 'pages') {
      
$post_type_sql "AND post_status = 'publish' AND post_type = 'page'";
    } else {
      
$post_type_sql "AND post_status = 'publish' AND post_type = 'post'";
    }
  }

  
// assuming $category_filter is a comma separated list of category ids,
  // modify query to join with post2cat table to select from only the chosen categories
  
$category_filter_join  "";
  
$category_filter_sql   "";
  
$category_filter_group "";
  if (
$category_filter != "") {
    if (
$wp_version >= '2.3') {
      
$category_filter_join  "LEFT JOIN $wpdb->term_relationships ON $wpdb->posts.ID = $wpdb->term_relationships.object_id LEFT JOIN $wpdb->term_taxonomy ON $wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id";
      
$category_filter_sql   "AND $wpdb->term_taxonomy.term_id IN ($category_filter)";   
      
$category_filter_group "GROUP BY $wpdb->posts.ID";

    } else {
      
$category_filter_join  "LEFT JOIN $wpdb->post2cat ON $wpdb->posts.ID = $wpdb->post2cat.post_id";
      
$category_filter_sql   "AND $wpdb->post2cat.category_id IN ($category_filter)";   
      
$category_filter_group "GROUP BY $wpdb->posts.ID";
    }
  }
  
  
// by default we sort images randomly,
  // but we can also sort them in descending date order
  
if ($sort_images_randomly) {
    
$order_by_sql "rand()";
  } else {
    
$order_by_sql "$wpdb->posts.post_date DESC";
  }

  
// query records that contain img tags, ordered randomly
  // do not select images from password protected posts
  
$sql "SELECT $wpdb->posts.ID, $wpdb->posts.post_title, $wpdb->posts.post_content, $wpdb->posts.post_excerpt
          FROM $wpdb->posts
          $category_filter_join
          WHERE (post_content LIKE '%<img%' or post_content LIKE '%[gallery]%')
          AND post_password = ''
          $post_type_sql
          $category_filter_sql
          $category_filter_group
          ORDER BY $order_by_sql"
;
  
$resultset = @mysql_query($sql$wpdb->dbh);
  
  if (
$debugging && mysql_error($wpdb->dbh)) print "mysql errors: " mysql_error($wpdb->dbh) . "<br/> SQL: " htmlspecialchars($sql) . "<br/>";;
  if (
$debuggingprint "elligible post count: " . @mysql_num_rows($resultset) . "<br/>"
  
  
// keep track of multiple images to prevent displaying dups
  
$image_srcs = array();

  
// loop through each applicable post from the database
  
$image_count 0;
  while (
$row mysql_fetch_array($resultset)) {
    
$post_title     $row['post_title'];
    
$post_permalink get_permalink($row['ID']);
    
$post_content   $row['post_content'];
    
$post_excerpt   $row['post_excerpt'];
    
$matches = array();

    
// find all img tags
    
preg_match_all("/<img[^>]+>/i"$post_content$matches);
    
    if (
$show_images_in_galleries) {
      
// find any gallery attachments
      
if (strpos($post_content'[gallery]') !== false) {
        
$sql "SELECT $wpdb->posts.guid, $wpdb->posts.post_excerpt
                FROM $wpdb->posts
                WHERE post_parent = '" 
$row['ID'] . "'
                AND post_type = 'attachment'
                AND post_password = ''
                AND post_mime_type in ('image/jpeg', 'image/gif', 'image/png')"
;
        
$resultset2 = @mysql_query($sql$wpdb->dbh);
        while (
$row2 mysql_fetch_array($resultset2)) {
          
$matches[0][] = "<img src='" $row2['guid'] . "' alt='" htmlspecialchars($row2['post_excerpt'], ENT_QUOTES) .  "' />";
        }
      }
    }

    
// if there are none, try again,  
    
if (count($matches[0]) == 0) {
      continue;
    }

    
// randomize the array of images in this post
    
shuffle($matches[0]);

    
// loop through each image candidate for this post and try to find a winner        
    
foreach ($matches[0] as $image_element) {
      
// grab the src attribute and see if it exists, if not try again
      
preg_match("/src\s*=\s*(\"|')(.*?)\\1/i"$image_element$image_src);
      
$image_src $image_src[2];
      
      
// Modifica rapporto larghezza/altezza immagini
    
list($width$height$type$attr)= getimagesize($image_src);
    if (
$width $height != "1.5") {
        continue;
      }

      
// make sure we haven't displayed this image before
      
if ($image_src == "" || in_array($image_src$image_srcs)) {
        continue;
      }

      
// if a regex is supplied and it doesn't match, try next post
      
if ($image_src_regex != "" && !preg_match("/" $image_src_regex "/i"$image_src)) {
        continue;
      }

      if (
$image_class_match != "") {
        
// grab the class attribute and see if it exists, if not try again
        
preg_match("/class\s*=\s*(\"|')(.*?)\\1/i"$image_element$image_classes);
        
$image_classes $image_classes[2];

        if (
$image_classes == '') {
          continue;
        }

        
$image_classes explode(" "$image_classes);
        if (!
in_array($image_class_match$image_classes)) {
          continue;
        }
      }

      
// add img src to array to check for dups
      
$image_srcs[] = $image_src;
         
      
// grab the alt attribute and see if it exists, if not supply default
      
preg_match("/alt\s*=\s*(\"|')(.*?)\\1/i"$image_element$image_alt);
      
$image_alt $image_alt[2];

      if (
$image_alt == "") {
        
$image_alt "random image";
      }

      
$image_html $image_template_html;
      
$image_html str_replace("%1"$post_title$image_html);
      
$image_html str_replace("%2""<a href='$post_permalink'><img class='imm-random' src='$image_src' alt='$image_alt' $image_attributes /></a>"$image_html);
      
      if (
$image_alt == 'random image') {
        
$image_html str_replace("%3"''$image_html);
      } else {
        
$image_html str_replace("%3"$image_alt$image_html);
      }

      
$image_html str_replace("%4"$post_excerpt$image_html);

      print 
$image_html;

      
$image_count++;
      
      if (
$image_count == $number_of_images) {
        return;
      } else {
        
// print a linebreak between each successive image
        
print "$inter_image_html\n";
      }
      
      
// leave the foreach loop and look for images
      // in other posts
      // TODO: if people wanted to display multiple images per post,
      // we would selectively skip this break
      
break;
    }
  }
}
?>
__________________
Gadget e idee regalo
DARKF3D3 non in linea   Rispondi citando
Vecchio 15-01-12, 16:06   #2 (permalink)
User
 
L'avatar di DARKF3D3
 
Data di registrazione: Nov 2009
Messaggi: 221
Sono riuscito a risolvere utilizzando questo script:
www . wprecipes . com / how-to-resize-images-on-the-fly
__________________
Gadget e idee regalo
DARKF3D3 non in linea   Rispondi citando
Vecchio 15-01-12, 18:48   #3 (permalink)
Moderatrice
 
L'avatar di Katherine
 
Data di registrazione: Jul 2010
Ubicazione: Treviso
Messaggi: 1,517
Grazie DARKF3D3
__________________

Katherine non in linea   Rispondi citando
Vecchio 16-01-12, 16:27   #4 (permalink)
User
 
L'avatar di DARKF3D3
 
Data di registrazione: Nov 2009
Messaggi: 221
Rispondo a questa discussione perché lo script sopraindicato ha risolto il problema del ridimensionamento, però ne ha creato un'altro.
Le immagini del widget che devo ridimensionare vengono ridimensionate e visualizzate correttamente nella home, mentre in tutte le altre pagine danno errore.

Questo è il codice che uso nel plugin:
Codice PHP:
<a href='$post_permalink'><img class='imm-random' src='wp-content/themes/Avenue/timthumb.php?src=$image_src&h=91&w=91&zc=1' alt='the_title()' /></a
Potete vedere l'errore andando nella home e spostandovi alla seconda pagina con i bottoni che ci sono in basso.
__________________
Gadget e idee regalo
DARKF3D3 non in linea   Rispondi citando
Vecchio 16-01-12, 17:15   #5 (permalink)
 
L'avatar di elmanisero
 
Data di registrazione: Apr 2011
Ubicazione: Bologna
Messaggi: 386
prova così
Codice PHP:
<a href='$post_permalink'><img class='imm-random' src='http://www.dottorgadget.it/wp-content/themes/Avenue/timthumb.php?src=$image_src&h=91&w=91&zc=1' alt='the_title()' /></a
__________________
www.giuseppebeghelli.it
elmanisero non in linea   Rispondi citando
Vecchio 16-01-12, 20:24   #6 (permalink)
User
 
L'avatar di DARKF3D3
 
Data di registrazione: Nov 2009
Messaggi: 221
Funziona, non ti dico i posti dove ho guardato per cercare di sistemarlo... e pensare che avevo la soluzione davanti al naso. Grazie per l'aiuto!
__________________
Gadget e idee regalo
DARKF3D3 non in linea   Rispondi citando
Rispondi


Strumenti di discussione

Regole di scrittura
Non puoi postare nuove discussioni
Non puoi rispondere alle discussioni
Non puoi allegare file
Non puoi editare i tuoi post

BB code is Attivo
smilies è Attivo
[IMG] il codice è Attivo
Il codice HTML è Disattivato
Trackbacks are Attivo
Pingbacks are Attivo
Refbacks are Disattivato
Vai al forum



Tutti gli orari sono GMT +3. Attualmente sono le 02:28.




Forum GT - © 2004-2009 GT idea S.r.l P.iva 02418200800 - Privacy/Disclaimer

SEO by vBSEO 3.2.0 ©2008, Crawlability, Inc.