infatti... ho provato adaggiungere un intval, ma nn funge uguale...acrux ha scritto:
infatti... ho provato adaggiungere un intval, ma nn funge uguale...acrux ha scritto:
We are the sons and daughters of all the freedom fighters.
And there are still many rivers to cross.
Hands in the air, screaming loud and clear for freedom, justice and equality.
There is no black or white, there is only right and wrong.
We are unknown heros, we are flesh and we are blood.
We are the great future.
We need to get back to the joy of living.
We are five fingers of an empty hand.
But together, we can also be the fist.
Sometimes change can be as simple as two hands reaching for one another.
Clap your hands.
hai provato a vede tra le tutte le opzioni opzioni del pannello di amministrazione tipo
Admin CP -> vBulletin Options -> Image Settings
Admin CP -> vBulletin Options -> Message Attachment Options -> Resize Images
Admin CP -> Attachments -> Attachment Manager
inoltre prAdmin CP -> Usergroups -> Usergroup Manager -> Edit Usergroups -> User Album Permissions
prova anche a vedere nel file include/config.php
ed impostare lunghezza e larghezza da li
// Image Processing Options
// Images that exceed either dimension below will not be resized by vBulletin. If you need to resize larger images, alter these settings.
$config['Misc']['maxwidth'] = xxxx;
$config['Misc']['maxheight'] = xxxx;
per tutte le funzionalità del forum che hai indicato, o non c'entrano o non collimano con la 3.01 (es. nel config non ho i parametri misc che hai indicato).
Infatti il maxwidth e il maxheight sono impostati a 800px per cui il problmea del resize degli allegati del forum per il futuro non esiste. Esiste per il passato dove le dimensioni consentite erano più grandi.
Certo, ce ne possiamo fregare tanto il casino sul forum riguarda img vecchie ma era una questione di puntiglio!
PS: anche se imposto - laddove il width del getimagesize sia null - la larghezza a 800px (e qui funziona!
http://forum.egcommunity.it/showthre...16#post=724216)
non posso usarlo perchè mi porta a 800 tutto quello che non legge, incluso la firma dei pollicini....
vado a spippolare l'attach.php....
Se per le immagini nuove il ridimensionamento funziona regolare mentre il problema resta per le vecchie temo sia un problema fisico. Cioè quando la funzione getimagesize lavora adopera un ridimensionamento dell'immagine originale creando una copia dell'immagine "tmp_img" con new width e new eight.highlander ha scritto:
Questa copia diventa quella che effettivamente viene richiamata dal db e fisicamente presente in una cartella sul server definita dal codice come cartella che contiene gli attached. Quindi penso che per quelle vecchie sia rimasto nel db i vecchi parametri relativi alle immagini oppure fisicamente le immagini "TEMP" non sono effettivamente ridimensionate.
Quindi le soluzioni sono 2:
O si deve mificare manualemte l'sql del DB se e un problema di "attributi delle immagini" (e non di dimesioni effettive"
O si deve manualmente risimensionare le immagini della cartella diciamo "temp" che e quella dove il forum salva le immagini allegate e che probabilmente tiene stoccate le immagini vecchie con il ridimensionamento non applicato (se è un problema di dimesioni effettive.
PS. il discorso del tmp_img e sicuramente valido per le ultime versioni del bulletin tipo la 3.7... a questo punto non so se per questa sia uguale visto che a quanto ho capito mi sembra sensibilmente meno "evoluta" quindi essendo più datata ipotizzo che possa essere piu un problema di db e modifica a mano delle table e record.
OVVIAMENTE PREVIO BACK-UP...
High prova cosi... sulla 3.0 dovrebbero andare bene
per il resize degli alllegati
apri includes/functions_file.php
--------------
cerca
--------------
error_reporting(E_ALL & ~E_NOTICE);
--------------
aggiungi sotto
--------------
// hack resize images
require_once('./includes/functions_image.php');
--------------
cerca
--------------
@unlink($attachment);
eval('$error = "' . fetch_phrase('attachbaddimensions', PHRASETYPEID_ERROR) . '";');
$errors[] = array(
'filename' => $attachment_name,
'error' => $error
);
return false;
--------------
sostituiscilo con
--------------
// hack image resize
$w = $imginfo[0];
$h = $imginfo[1];
switch($imginfo[2]) {
case 1:
$imt = "gif";
break;
case 2:
$imt = "jpg";
break;
case 3:
$imt = "png";
break;
}
switch($imt) {
case gif:
$im=imagecreatefromgif($attachment);
break;
case png:
$im=imagecreatefrompng($attachment);
break;
case jpg:
$im=imagecreatefromjpeg($attachment);
break;
}
$width_factor = $w / $maxattachwidth;
$height_factor = $h / $maxattachheight;
if ($width_factor > $height_factor)
{
$nw = round($w / $width_factor);
$nh = round($h / $width_factor);
}
else
{
$nw = round($w / $height_factor);
$nh = round($h / $height_factor);
}
$ni=imagecreatetruecolor($nw,$nh);
ImageCopyResampled($ni,$im,0,0,0,0,$nw,$nh,$w,$h);
UnsharpMask($ni);
switch($imt) {
case gif:
$filesize2 = @filesize(@imagepng($ni,$attachment));
//@ImageJPEG($ni,$attachment,60);
break;
case png:
$filesize2 = @filesize(@imagepng($ni,$attachment));
//@ImageJPEG($ni,$attachment,60);
break;
case jpg:
$filesize2 = @filesize(@ImageJPEG($ni,$attachment,60));
break;
}
//// image resize replaced ////
/*
@unlink($attachment);
eval('$error = "' . fetch_phrase('attachbaddimensions', PHRASETYPEID_ERROR) . '";');
$errors[] = array(
'filename' => $attachment_name,
'error' => $error
);
return false;
*/
---------------
cerca
---------------
require_once('./includes/functions_image.php');
---------------
sostituiscilo con
---------------
// hack image resize
// require_once('./includes/functions_image.php');
========================================
per il resize degli avatar e delle foto nel profilo utente
in includes/functions_upload.php
cerca
error_reporting(E_ALL & ~E_NOTICE);
aggiungi sopra
require_once('./includes/functions_image.php');
cerca
if ($showerrors)
{
@unlink($filename);
if ($incp)
{
print_stop_message('the_uploaded_image_is_too_larg e', $maxwidth, $maxheight);
}
else
{
eval(print_standard_error('error_imagebaddimension s'));
}
}
else
{
return false;
}
sostituisci con
$w = $imginfo[0];
$h = $imginfo[1];
switch($imginfo[2]) {
case 1:
$imt = "gif";
break;
case 2:
$imt = "jpg";
break;
case 3:
$imt = "png";
break;
}
switch($imt) {
case gif:
$im=imagecreatefromgif($filename);
break;
case png:
$im=imagecreatefrompng($filename);
break;
case jpg:
$im=imagecreatefromjpeg($filename);
break;
}
$width_factor = $w / $maxwidth;
$height_factor = $h / $maxheight;
if ($width_factor > $height_factor)
{
$nw = round($w / $width_factor);
$nh = round($h / $width_factor);
}
else
{
$nw = round($w / $height_factor);
$nh = round($h / $height_factor);
}
$ni=imagecreatetruecolor($nw,$nh);
ImageCopyResampled($ni,$im,0,0,0,0,$nw,$nh,$w,$h);
UnsharpMask($ni);
switch($imt) {
case gif:
@imagepng($ni,$filename);
break;
case png:
@imagepng($ni,$filename);
break;
case jpg:
@ImageJPEG($ni,$filename,60);
break;
}
/*if ($showerrors)
{
@unlink($filename);
if ($incp)
{
print_stop_message('the_uploaded_image_is_too_larg e', $maxwidth, $maxheight);
}
else
{
eval(print_standard_error('error_imagebaddimension s'));
}
}
else
{
return false;
}*/
ACRUX...FRENA UN SECONDO!!!!acrux ha scritto:
ti spiego dove nasce il problema:
il ridimensionamento ad un link esterno di un file immagine (bmp, gif, jpg, png etc) funziona, ma non va a scrivere nessun tmp: se vai nell'esempio di questa discussione vedrai che non è altro che l'immagine originale con gli attributi wiodth o height ridimensionati. ci clicchi sopra e ti apre in dimensioni orignali.
diverso è invece il caso in cui il tag [IMG] contenga un file che NON termina con i suffissi delle immagini (nel nostro caso tutti gli allegati del forum che terminano con il numero di attachid.)
In questo caso il getimagesize da come risultato NULL.
Non posso impostare a 800px di width tutti i link IMG di questo genere perchè scasina anche le immagini piccole (stemma pollicini).
Allora sono andato a vedere il file attachment.php dove - lì sì - riesco a beccare le dimensioni con le variabili $attachmentinfo['width'] e $attachmentinfo['height']
Il problema è che queste variabili, contenute nel file attachment.php non riesco a farle passare nel bbcodeparse.php dove la funzione image_match distingue tra link esterni e non.
Se riuscissi a fargli succhiare queste 2 variabili, già opportunamente ridimensionate dove necessario - il bbcode che ritorna non sarebbe quello con le immagini originali ma quello con le dimensioni corrette.
Riepilogo:
Abbiamo il case "forum" di default (no chat, no MP etc) nel quale il tag IMG è allowed.
la pagina è showthread.php. Questa utilizza per il contenuto del messaggio la funzione bbcodeparse.php e contiene il link alla pagina attachment.php
come ne usciamo???
Tieni conto che l'hack che mi hai suggerito mi appesantisce troppo il server. Abbiamo già allegati per oltre 2 Giga...
Ho provato una modifica sulla 3.03highlander ha scritto:
e mi funziona su tutti i return img del bbcode.php
sfrutta una javascript
prima cosa bisogna copiare questo file [font='Verdana','sans-serif']resizevbimg.js nella cartella [font='Verdana','sans-serif']clientscript (Il javascript l'ho impostato a larghezza 800[/font][/font]
[font='Verdana','sans-serif'][font='Verdana','sans-serif'][/font][/font]
nel bbcodeparse.php
cerca
return '<img src="' . $link . '" border="0" alt="" />'; [font='Verdana','sans-serif']
[/font]e sostituiscilo con
return '<img src="' . $link . '" border="0" alt="" id="vBCodeIMG" />'; [font='Verdana','sans-serif']
[/font]
dopo bisogna fare alcune modifice sul template
[font='Verdana','sans-serif']Styles & Templates > [font='Verdana','sans-serif']Search[/font][font='Verdana','sans-serif'] the SHOWTHREAD Template[/font][/font]
[font='Verdana','sans-serif'][/font]
[font='Verdana','sans-serif']cerca[/font]
[font='Verdana','sans-serif']<body onload="$onload"> [font='Verdana','sans-serif']
[/font][/font][font='Verdana','sans-serif']sostituisci con[/font]
[font='Verdana','sans-serif']<body onload="$onload;vbImageResize()"> [font='Verdana','sans-serif']
[/font][/font][font='Verdana','sans-serif'][/font][font='Verdana','sans-serif'][font='Verdana','sans-serif']Styles & Templates > [font='Verdana','sans-serif']Search[/font][font='Verdana','sans-serif'] the NEWREPLY Template[/font][/font][/font]
[font='Verdana','sans-serif'][font='Verdana','sans-serif'][/font][/font]
[font='Verdana','sans-serif'][font='Verdana','sans-serif']cerca[/font][/font]
[font='Verdana','sans-serif'][font='Verdana','sans-serif']<body$onload> [font='Verdana','sans-serif']
[/font][/font][/font][font='Verdana','sans-serif'][font='Verdana','sans-serif']sostituisci con[/font][/font]
[font='Verdana','sans-serif'][font='Verdana','sans-serif']<body onload="$onload;vbImageResize()"> [font='Verdana','sans-serif']
[/font][/font][/font][font='Verdana','sans-serif'][font='Verdana','sans-serif'][font='Verdana','sans-serif']Styles & Templates > Style Manager > Common Templates > headinclude[/font][/font][/font]
[font='Verdana','sans-serif'][font='Verdana','sans-serif'][font='Verdana','sans-serif'][/font][/font][/font]
[font='Verdana','sans-serif'][font='Verdana','sans-serif'][font='Verdana','sans-serif']cerca[/font][/font][/font]
[font='Verdana','sans-serif'][font='Verdana','sans-serif'][font='Verdana','sans-serif']<!-- / CSS Stylesheet --> [font='Verdana','sans-serif']
[/font][/font][/font][/font][font='Verdana','sans-serif'][font='Verdana','sans-serif'][font='Verdana','sans-serif']aggiungi dopo[/font][/font][/font]
[font='Verdana','sans-serif'][font='Verdana','sans-serif'][font='Verdana','sans-serif']<script type="text/javascript" src="clientscript/resizevbimg.js"></script>[font='Verdana','sans-serif']
[/font][/font][/font][/font][font='Verdana','sans-serif'][font='Verdana','sans-serif'][font='Verdana','sans-serif'][font='Verdana','sans-serif']Styles & Templates > Style Manager > Main [font='Verdana','sans-serif']CSS[/font][font='Verdana','sans-serif'] > Additional [/font][font='Verdana','sans-serif']CSS[/font][font='Verdana','sans-serif'] Definitions[/font][/font][/font][/font][/font]
[font='Verdana','sans-serif'][font='Verdana','sans-serif'][font='Verdana','sans-serif'][font='Verdana','sans-serif']aggiungi alla fine[/font][/font][/font][/font]
[font='Verdana','sans-serif'][font='Verdana','sans-serif'][font='Verdana','sans-serif'][font='Verdana','sans-serif'][/font][/font][/font][/font]
[font='Verdana','sans-serif'][font='Verdana','sans-serif'][font='Verdana','sans-serif'][font='Verdana','sans-serif'].vbimgcodelimit {
cursor: pointer;
border: dotted 1px black;
} [font='Verdana','sans-serif']
[/font][/font][/font][/font][/font]
questa ma piasce!acrux ha scritto:
ho fatto tutto ma non funge
http://forum.egcommunity.it/showthre...16#post=724216