Précédent   Forum des professionnels en informatique > PHP > PHP & SGBD
PHP & SGBD Forum d'entraide sur les SGBD avec PHP. Avant de poster : FAQ BDD, toutes les FAQ PHP, cours BDD et sources BDD
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 25/01/2012, 12h36   #1
Membre du Club
 
Inscription : janvier 2008
Messages : 706
Détails du profil
Informations forums :
Inscription : janvier 2008
Messages : 706
Points : 66
Points : 66
Par défaut Fatal error: Out of memory (allocated 30408704) (tried to al

Bonjour,

suite a un script upload qui fonctionner tres bien ce matin, j'ai ce message qui s'affiche:

Fatal error: Out of memory (allocated 30408704) (tried to allocate 12288 bytes) in /homepages/25/d360145515/htdocs/mybabylove/lib/thumbs.class.php on line 364</code>

je fais des recherche et on me dit que ca peut etre la taille mais je ne comprend pas ce matin cela fonctionner meme avec ces images.

voici ma fonction:

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
public function upload($_FILES,$idAnnonce,$idInscrit)
	{
 
/*------------------------------------------------------------------------------*/
		/*Creation des dossiers d'illsutration si ils n'existent pas de chaque produit*/
		/*-----------------------------------------------------------------------------*/	
 
		$dirSmall='illustration/small';
 
 
			if (is_dir($dirSmall)) 
			{
 
				/***************************on verifie si le dossier small du produit existe****************/
				if(!is_dir($dirSmall.'/'.$idAnnonce))
				{
 
					$dossierSmall=mkdir($dirSmall.'/'.$idAnnonce);
 
 
				}
 
				/*------------------------------------------------------------------------------*/
				/*Creation des miniatures en 1 formats differents (300*300)*********/
				/*-----------------------------------------------------------------------------*/						
 
				$NomImageFinalSmall= $idInscrit.'-'.$idAnnonce.'-'.'small';
 
 
				if(isset($_FILES['fichier']['name']))
				{
 
					$source_image_extension = thumbs::get_image_extension($_FILES['fichier']['name']);
					$source_image_path = 'illustration/background.'.$source_image_extension;
 
					if(move_uploaded_file($_FILES['fichier']['tmp_name'], $source_image_path))
					{
 
						$thumbs_saving_path_Small = 'illustration/small/'.$idAnnonce.'/';
 
						$thumbs_image_quality = 100;
 
						$tbSmall= new thumbs($source_image_path, $thumbs_saving_path_Small, $thumbs_image_quality);
						$tbSmall->resize(300,300,"FFFFFF",$NomImageFinalSmall.'.jpeg');
 
 
						unlink($source_image_path);
					}
				}
				else
				{
					echo 'Le sous-dossier de l illustration n existe pas.';
				}
 
				}
			else
			{
				echo 'Le dossier de l illustration small n existe pas.';
			}
 
 
 
 
 
	}
?>
on m'a dit que ca pouvait venir d'une erreur de code, comme une boucle.

voici l'appel de la fonction:
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
 
<?php
//verifie si les variables existent si c est un ajout ou une modification
if (isset ($_POST['id_rubrique_annonce'])and isset ($_POST['titre_annonce'])and isset ($_POST['description_annonce'])
 and isset ($_POST['prix_annonce']) and isset ($_POST['id_inscrit_annonce'])and isset ($_POST['id_annonce']))
{
 
if(isset($_FILES['fichier']))
{
$_POST['illustration_annonce']=$_POST['id_inscrit_annonce'].'-'.$_POST['id_annonce'].'-'.'home.jpeg';
}
	$annonce = new Annonce (
	array (
	'id_rubrique_annonce' => ($_POST['id_rubrique_annonce']),
	'etat_annonce' => ($_POST['etat_annonce']),
	'titre_annonce' => ($_POST['titre_annonce']),
	'description_annonce' => ($_POST['description_annonce']),
	'prix_annonce' => ($_POST['prix_annonce']),
	'illustration_annonce' => $_POST['illustration_annonce'],
	'id_inscrit_annonce' => ($_POST['id_inscrit_annonce'])
 
	)
	);
 
 
	if (isset($_POST['id_annonce']))
	$annonce->setIdAnnonce($_POST['id_annonce']);
 
 
	//verifie si les variables ne sont pas vide
	if ($annonce->isValid())
	{
 
		$managerAnnonce->save($annonce);
 
		$message = $annonce->isAnnonce() ? 'L Annonce a bien &eacute;t&eacute; ajout&eacute;e !' : 'L Annonce a bien &eacute;t&eacute; modifi&eacute;e !';
 
		if (isset($_FILES['fichier']))
		{
		$managerAnnonce->upload($_FILES,$_POST['id_annonce'],$_POST['id_inscrit_annonce']);
		}
	}
	else
 
	$erreurs = $annonce->erreurs();
 
}
?>
merci.
kate59 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/01/2012, 14h06   #2
Modérateur
 
Inscription : septembre 2010
Messages : 7 219
Détails du profil
Informations forums :
Inscription : septembre 2010
Messages : 7 219
Points : 8 598
Points : 8 598
tu charges une image qui est trop grande (pas grosse, grande), il va falloir accepter des images de petite en résolution, GD prend beaucoup de mémoire
__________________
http://blog.stealth35.com/
stealth35 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 00h05.


 
 
 
 
Partenaires

Hébergement Web