phpBB Italia chiude!
phpBB Italia ringrazia tutti gli utenti che hanno dato fiducia al nostro progetto per ben 9 anni, e che, grazie al grande lavoro fatto da tutto lo Staff (rigorosamente a titolo gratuito), hanno portato il portale a diventare il principale punto di riferimento italiano alla piattaforma phpBB.

Purtroppo, causa motivi personali, non ho più modo di gestirlo e portarlo avanti. Il forum viene ora posto in uno stato di sola lettura, nonché un archivio storico per permettere a chiunque di fruire di tutte le discussioni trattate.

Il nuovo portale di assistenza per l'Italia di phpBB diventa phpBB-Store.it, cui ringrazio per aver deciso di portare avanti questo grande progetto.

Grazie ancora,
Carlo - Amministratore di phpBB Italia

Errore upload avatar

Supporto MODs generale.
artikkk
phpBB Expert
phpBB Expert
Messaggi: 404
Iscritto il: 18/06/2010, 9:04
Sesso: Maschio
Versione: 3.0.11
Server: UNIX/Linux
PHP: 5.2.17
Database: MySQL 5.1.57
Contatta:

Errore upload avatar

Messaggio da artikkk » 02/11/2011, 11:07

Quando cambio un avatar e utilizzo la funzione upload da desktop, esce questo errore.
L'avatar viene caricato ugualemente, ma l'errore non è molto carino da vedere :oops:
Come posso risolvere? Non ne ho idea.. grazie a tutti

Codice: Seleziona tutto

[phpBB Debug] PHP Warning: in file /includes/dv_functions_image.php on line 241: imagejpeg() [function.imagejpeg]: Unable to open '9d5b57270f2599d69d0cd9e801465564' for writing: Permission denied
[phpBB Debug] PHP Warning: in file /includes/dv_functions_image.php on line 198: filesize() [function.filesize]: stat failed for 9d5b57270f2599d69d0cd9e801465564
[phpBB Debug] PHP Warning: in file /includes/dv_functions_image.php on line 198: filesize() [function.filesize]: stat failed for 9d5b57270f2599d69d0cd9e801465564
[phpBB Debug] PHP Warning: in file /includes/dv_functions_image.php on line 248: unlink(9d5b57270f2599d69d0cd9e801465564) [function.unlink]: No such file or directory

Warning: Cannot modify header information - headers already sent by (output started at /home/admin/domains/pronosky.com/public_html/forum/includes/functions.php:3820) in /home/admin/domains/pronosky.com/public_html/forum/includes/functions.php on line 4749

Warning: Cannot modify header information - headers already sent by (output started at /home/admin/domains/pronosky.com/public_html/forum/includes/functions.php:3820) in /home/admin/domains/pronosky.com/public_html/forum/includes/functions.php on line 4751

Warning: Cannot modify header information - headers already sent by (output started at /home/admin/domains/pronosky.com/public_html/forum/includes/functions.php:3820) in /home/admin/domains/pronosky.com/public_html/forum/includes/functions.php on line 4752

Warning: Cannot modify header information - headers already sent by (output started at /home/admin/domains/pronosky.com/public_html/forum/includes/functions.php:3820) in /home/admin/domains/pronosky.com/public_html/forum/includes/functions.php on line 4753

Avatar utente
Carlo
Amministratore
Amministratore
Messaggi: 9957
Iscritto il: 19/04/2009, 10:24
Sesso: Maschio
Versione: 3.2.0
Server: UNIX/Linux
PHP: 7.1.0
Database: MySQL(i) 10.0.27-MariaDB-cll-lve
Località: Puglia
Contatta:

Re: Errore upload avatar

Messaggio da Carlo » 02/11/2011, 15:23

Il file includes/dv_functions_image.php, non è presente in phpBB.
Usi qualche MOD per gli avatar?
MODs | Stili | Traduzioni MOD
Ogni MP contenente una richiesta di supporto verrà ignorato.

artikkk
phpBB Expert
phpBB Expert
Messaggi: 404
Iscritto il: 18/06/2010, 9:04
Sesso: Maschio
Versione: 3.0.11
Server: UNIX/Linux
PHP: 5.2.17
Database: MySQL 5.1.57
Contatta:

Re: Errore upload avatar

Messaggio da artikkk » 02/11/2011, 19:42

Mi dispiace contraddirti, ma il file da te citato è presente nella cartella includes/
Uso la mod per il ridimensionamento automatico

Codice: Seleziona tutto

###############################################################
## MOD Title:	Avatar auto resize
## MOD Author:	doviet < dev@doviet.net > (Do Viet)
## MOD Description: This MOD resizes automatically user's avatar when it reaches the limit of max width, max height or max filesize
## MOD Version: 0.0.4b
il file includes/dv_functions_image.php me lo fa aggiungere proprio questa mod..
Ecco il contenuto

Codice: Seleziona tutto

<?php
//
// includes/dv_functions_image.php (1.1.0)
// Do Viet (dev@doviet.net)
//

//////////////////////////////////
//		 HISTORY			//
//////////////////////////////////
// Version 1.0.1
//	- First release
//	- Resize images by max width and max height limit
//	- Supported image format: JPEG
//
// Version 1.0.2 - 26/04/2008
//	- Added supported image formats: GIF (non-transparent, static) & PNG (non-transparent)
//
// Version 1.0.3 - 28/04/2008
//	- Added supported image formats: GIF transparent & PNG 24-bit transparent
//
// Verion 1.1.0 - 26/06/2008
//	-  New: resize JPEG images by filesize limit
/////////////////////////////////////////////////////////////////////////////////////

class Image
{
	private $check_ext;
	private $max_width, $max_height, $max_filesize;
	
	private $img;
	private $infos;
	
	private $q, $lo_q;
	
	function Image($img)
	{
		$this->img = $img;
		$this->check_ext = array("jpg", "jpe", "jpeg", "gif", "png");
		
		$this->get_infos();
	}
	
	function set_max_height($mh)
	{
		$this->max_height = $mh;
	}
	
	function no_max_height()
	{
		$this->max_height = 0;
	}
	
	function set_max_width($mw)
	{
		$this->max_width = $mw;
	}
	
	function no_max_width()
	{
		$this->max_width = 0;
	}
	
	function set_max_filesize($ms)
	{
		$this->max_filesize = $ms;
	}
	
	function no_max_filesize()
	{
		$this->max_filesize = 0;
	}
	
	function ext_accept($extensions) // str
	{
		$this->check_ext = explode(",", $extensions);
	}
	
	function get_extension()
	{
		$filename = basename($this->img);
		$ext = substr($filename, strrpos($filename, "."), strlen($filename));
		return $ext;
	}
	
	function get_content_type()
	{
		if(empty($this->infos))
		{
			$this->get_infos();
		}
		
		if($this->infos['width']!=0 && $this->infos['height']!=0)
		{
			return image_type_to_mime_type($this->infos['type']);
		}
		else
		{
			return false;
		}
	}
	
	function get_infos()
	{
		list($this->infos['width'], $this->infos['height'], $this->infos['type']) = getimagesize($this->img);
		$this->max_width = 0;
		$this->max_height = 0;
		$this->min_width = 10;
		$this->q = 100;
		$this->lo_q = 30;
	}
	
	function get_new_dimensions($width, $height, $max_width, $max_height = 0)
	{
		$new_width = $width;
		$new_height = $height;
		
		if($max_height!=0 && $max_width==0)
		{
			if($height > $max_height)
			{
				$new_height = $max_height;
				$new_width = round($width * $max_height / $height, 1);
			}
		}
		else if($max_width!=0 && $max_height==0)
		{
			if($width > $max_width)
			{
				$new_width = $max_width;
				$new_height = round($height * $max_width / $width, 1);
			}
		}
		else
		{
			if($max_height!=0 && $max_width!=0)
			{
				if($width >= $height
				&& $width >= $max_width)
				{
					$new_width = $max_width;
					$new_height = round($height * $new_width / $width, 1);
					if($new_height > $max_height)
					{
						$new_height2 = $max_height;
						$new_width2 = round($new_width * $new_height2 / $new_height, 1);
						$new_height = $new_height2;
						$new_width = $new_width2;
					}
				}
				else if($height >= $width
				&& $height >= $max_height)
				{
					$new_height = $max_height;
					$new_width = round($width * $new_height / $height, 1);
					if($new_width > $max_width)
					{
						$new_width2 = $max_width;
						$new_height2 = round($new_height * $new_width2 / $new_width, 1);
						$new_width = $new_width2;
						$new_height = $new_height2;
					}
				}
			}
		}
		
		return array($new_width, $new_height);
	}
	
	function create_thumb($source, $w_source, $h_source, $th_width, $th_height)
	{
		$thumb = $this->generate_thumb($source, $w_source, $h_source, $th_width, $th_height);
		
		// Reduce filesize
		if($this->max_filesize)
		{
			$thumb = $this->reduce_filesize($source, $thumb, $w_source, $h_source, $th_width, $th_height);
		}
		
		return $thumb;
	}
	
	function generate_thumb($source, $w_source, $h_source, $th_width, $th_height)
	{
		$thumb = imagecreatetruecolor($th_width, $th_height);
		imagecopyresampled($thumb, $source, 0, 0, 0, 0, $th_width, $th_height, $w_source, $h_source);
		return $thumb;
	}
	
	function get_filesize($img, $remote = 0)
	{
		if($remote)
		{
			// Not available yet
			return 0;
		}
		else
		{
			return filesize($img);
		}
	}
	
	function get_thumb_filesize($thumb)
	{
		$img = md5(time());
		switch($this->get_content_type())
		{
			case "image/jpeg":
				imagejpeg($thumb, $img, $this->q);
			break;
			case "image/gif";
				imagegif($thumb, $img);
			break;
			case "image/png";
				imagepng($thumb, $img);
			break;
		}
		if(file_exists($img))
		{
			$fs = $this->get_filesize($img);
			unlink($img);
			return $fs;
		}
		else
		{
			return 0;
		}
	}
	
	function reduce_filesize($source, $thumb, $w_source, $h_source, $th_width, $th_height)
	{
		$img = $this->img;
		switch($this->get_content_type())
		{
			case "image/jpeg":
				$tmp_imgs = array();
				
				do
				{
					$img = md5($img);
					$tmp_imgs[] = $img;
					imagejpeg($thumb, $img, $this->q);
					$this->q--;
				}
				while($this->get_filesize($img)>$this->max_filesize && $this->q>$this->lo_q);
				$last_filesize = $this->get_filesize($img);
				foreach($tmp_imgs as $ti)
				{
					unlink($ti);
				}
				
				// After reducing image quality, the filesize is still bigger than the limit 
				if($last_filesize>$this->max_filesize)
				{
					return $this->reduce_dimensions_by_filesize($source, $w_source, $h_source, $last_filesize);
				}
				else
				{
					return $thumb;
				}
			break;
			case "image/gif";
				return $thumb;
			break;
			case "image/png";
				return $thumb;
			break;
		}
	}
	
	function reduce_dimensions_by_filesize($source, $w_source, $h_source, $filesize)
	{
		$max_width = $this->max_width;
		
		while($filesize>$this->max_filesize && $max_width>$this->min_width)
		{
			$max_width -= 5;
			list($new_width, $new_height) = $this->get_new_dimensions($w_source, $h_source, $max_width, 0);
			$thumb = $this->generate_thumb($source, $w_source, $h_source, $new_width, $new_height);
			$filesize = $this->get_thumb_filesize($thumb);
		}
		
		return $thumb;
	}
	
	function resize($save_to_source = 1)
	{
		list($new_width, $new_height) = $this->get_new_dimensions($this->infos['width'], $this->infos['height'], $this->max_width, $this->max_height);
		if($new_height!=$this->infos['height'] || $new_width!=$this->infos['width'])
		{
			switch($this->get_content_type())
			{
				case "image/jpeg":
					$source = imagecreatefromjpeg($this->img);
					$thumb = $this->create_thumb($source, $this->infos['width'], $this->infos['height'], $new_width, $new_height);
					
					if($save_to_source)
					{
						imagejpeg($thumb, $this->img, $this->q);
						return true;
					}
					else
					{
						header("Content-Type: ".$this->get_content_type());
						imagejpeg($thumb, null, $this->q);
					}
				break;
				case "image/gif":
					$source = imagecreatefromgif($this->img);
					$thumb = $this->create_thumb($source, $this->infos['width'], $this->infos['height'], $new_width, $new_height);
					
					if($save_to_source)
					{
						imagegif($thumb, $this->img);
						return true;
					}
					else
					{
						header("Content-Type: ".$this->get_content_type());
						imagegif($thumb);
					}
				break;
				case "image/png":
					$source = imagecreatefrompng($this->img);
					$thumb = $this->create_thumb($source, $this->infos['width'], $this->infos['height'], $new_width, $new_height);
					
					if($save_to_source)
					{
						imagepng($thumb, $this->img);
						return true;
					}
					else
					{
						header("Content-Type: ".$this->get_content_type());
						imagepng($thumb);
					}
				break;
				default:
					// Do nothing
					return false;
			}
		}
	}
}
?>
Grazie

Angolo
Leader Traduttori
Leader Traduttori
Messaggi: 7237
Iscritto il: 11/03/2011, 17:37
Sesso: Maschio
Versione: 3.0.12
Server: UNIX/Linux
PHP: 5.6.18
Database: MySQL 5.6.33-log
Contatta:

Re: Errore upload avatar

Messaggio da Angolo » 02/11/2011, 20:05

Appunto. È presente nella tua cartella includes.
Ma non è presente nel phpBB3 puro.
Dunque, la causa è una MOD o installata o disinstallata male.

artikkk
phpBB Expert
phpBB Expert
Messaggi: 404
Iscritto il: 18/06/2010, 9:04
Sesso: Maschio
Versione: 3.0.11
Server: UNIX/Linux
PHP: 5.2.17
Database: MySQL 5.1.57
Contatta:

Re: Errore upload avatar

Messaggio da artikkk » 02/11/2011, 20:41

l'installazione è corretta, è nel file che ho inserito l'errore..
Qualche idea per risolverlo?

Angolo
Leader Traduttori
Leader Traduttori
Messaggi: 7237
Iscritto il: 11/03/2011, 17:37
Sesso: Maschio
Versione: 3.0.12
Server: UNIX/Linux
PHP: 5.6.18
Database: MySQL 5.6.33-log
Contatta:

Re: Errore upload avatar

Messaggio da Angolo » 02/11/2011, 20:45

Se l'installazione è corretta e ti dà errore significa che la MOD è buggata.
La MOD è in versione stabile? Hai verificato sul com, se la cosa è stata segnalata.


Sposto in supporto MOD: non è un problema del phpBB3.

Avatar utente
Micogian
Leader Programmatori
Leader Programmatori
Messaggi: 3704
Iscritto il: 07/01/2010, 8:51
Versione: 3.2.0
Server: UNIX/Linux
PHP: 5.4.36
Database: MySQL 5.1.70-log
Località: Udine
Contatta:

Re: Errore upload avatar

Messaggio da Micogian » 02/11/2011, 23:03

Io non conosco questa Mod ma se l'avatar da ridimensionare è quello del profilo nei topics c'è un modo molto semplice per farlo.
Nel file viewtopic.php cercare la parte di codice:

Codice: Seleziona tutto

// Posts are stored in the $rowset array while $attach_list, $user_cache
// and the global bbcode_bitfield are built
while ($row = $db->sql_fetchrow($result))
{
e aggiungere

Codice: Seleziona tutto

	// Ridimensiona Avatar se superiore di 140 px
	if ($row['user_avatar_width'] > 140 )
	{
	$row['user_avatar_height'] = ($row['user_avatar_height'] * '140' /  $row['user_avatar_width']);
	$row['user_avatar_width'] = 140 ;   
	}
	// fine ridimensiona Avatar
Ovviamente la dimensione di 140px è modificabile.
Il risultato sarà che gli avatar dei Posts saranno ridimensionati a 140px di larghezza se superiori,mentre l'altezza viene in proporzione.
Quattro righe di codice, senza bisogno di Mod complicate.
Se poi si vuole ridimensionare l'avatar in tutte le occasioni il discorso cambia, anche se il principio sarebbe sempre valido.

Avatar utente
Haku
Utente
Utente
Messaggi: 2529
Iscritto il: 22/09/2009, 22:36
Sesso: Maschio
Versione: 3.0.9
Server: UNIX/Linux
Contatta:

Re: Errore upload avatar

Messaggio da Haku » 03/11/2011, 13:39

Segui il consiglio di bingo e risolverai...ho utilizzato lo stesso code anche io ^^

Rispondi

Torna a “Supporto MODs”

Chi c’è in linea

Visitano il forum: Nessuno e 42 ospiti