Ciao a tutti.
Premetto di non aver voluto postare in sezione CMS perché parlerò di PhpThumb e non di WP, anche se è una funzione che utilizzero all'interno di quest'ultimo.
Ho un problema con PhpThumb, appunto, il quale mi crea le miniature solo se l'immagine si trova all'interno degli articoli residenti sul mio sito, ma se ad esempio faccio un link ad un immagine esterna PhpThumb non funziona.
Sono sicurissimo di dover modificare pochissima roba per far si che miniaturizzi anche le immagini esterne "attaccate" nei miei post ma non riesco a ragionarci sopra e mi servirebbe una mano esperta.
Qui lo script:
Codice PHP:
function show_thumb_f($width,$crop,$quality) {
global $post;
$custom_field_value = get_post_meta($post->ID, 'Image', true);
$attachments = get_children( array('post_parent' => $post->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID', 'numberposts' => 1) );
if ($attachments == true) {
foreach($attachments as $id => $attachment) {
$img = wp_get_attachment_image_src($id, 'full');
$tweak = str_replace('/', '%2F', $img[0]);
$img_url = str_replace(':', '%3A', $tweak);
print '[img]'.get_template_directory_uri().'/scripts/phpThumb/phpThumb.php?src='.$img_url.'&w='.$width.'&zc='.$crop.'&q='.$quality.'[/img]post_title.'" alt="'.$post->post_title.'" />';
}
} elseif ( $custom_field_value == true) {
$tweak = str_replace('/', '%2F', $custom_field_value);
$img_url = str_replace(':', '%3A', $tweak);
print '[img]'.get_template_directory_uri().'/scripts/phpThumb/phpThumb.php?src='.$img_url.'&w='.$width.'&zc='.$crop.'&q='.$quality.'[/img]post_title.'" alt="'.$post->post_title.'" />';
} else {
// do nothing
}
}
Ringrazio in anticipo.