Php fonction imagecreatefromjpeg
lud1979
Messages postés
51
Date d'inscription
Statut
Membre
Dernière intervention
-
Zep3k!GnO Messages postés 2025 Date d'inscription Statut Membre Dernière intervention -
Zep3k!GnO Messages postés 2025 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
J'ai un soucis avec la fonction imagecreatefromjpeg dans mon script php ci-dessous.
Je test mon script en local avec easyphp, GD-2 est bien activé dans php.ini
le message d'erreur est le suivant:
Warning: imagecreatefromjpeg(http://localhost/recadrer/recadrer.jpg) [function.imagecreatefromjpeg]: failed to open stream: Une tentative de connexion a échoué car le parti connecté n'a pas répondu convenablement au-delà d'une certaine durée ou une connexion établie a échoué car l'hôte de connexion n'a pas répondu. in C:\Program Files\EasyPHP-5.3.3\www\recadre.php on line 16
mon script est le suivant
<?php
//définition des variables
set_time_limit(2000);
//init_set("memory_limit", "128M");
$base = "http://localhost/recadrer/";
$imgfile = $base."recadrer.jpg";
$dest_small = $base."mini-image-gd.jpg";
$cropStartX = $_POST['sx'];
$cropStartY = $_POST['sy'];
$cropW = $_POST['ex'];
$cropH = $_POST['ey'];
// création des deux images temporaires
$origimg = imagecreatefromjpeg($imgfile);
$cropimg = imagecreatetruecolor($cropW,$cropH);
// résolution de l'image
list($width, $height) = getimagesize($imgfile);
// Crop
imagecopyresized($cropimg, $origimg, 0, 0, $cropStartX, $cropStartY, $width, $height, $width, $height);
// copie vers répertoire
imagejpeg($cropimg, $dest_small, 80);
// Début du redimensionnement
$thumb = imagecreatetruecolor(100, 100);
$source = imagecreatefromjpeg($dest_small);
imagecopyresized($thumb, $source, 0, 0, 0, 0, 100, 100, $cropW, $cropH);
// copie vers répertoire
imagejpeg($thumb, $dest_small, 80);
// Fin du redimmensionnement
>
Quelqu'un aurais t'il une idée?
merci d'avance
J'ai un soucis avec la fonction imagecreatefromjpeg dans mon script php ci-dessous.
Je test mon script en local avec easyphp, GD-2 est bien activé dans php.ini
le message d'erreur est le suivant:
Warning: imagecreatefromjpeg(http://localhost/recadrer/recadrer.jpg) [function.imagecreatefromjpeg]: failed to open stream: Une tentative de connexion a échoué car le parti connecté n'a pas répondu convenablement au-delà d'une certaine durée ou une connexion établie a échoué car l'hôte de connexion n'a pas répondu. in C:\Program Files\EasyPHP-5.3.3\www\recadre.php on line 16
mon script est le suivant
<?php
//définition des variables
set_time_limit(2000);
//init_set("memory_limit", "128M");
$base = "http://localhost/recadrer/";
$imgfile = $base."recadrer.jpg";
$dest_small = $base."mini-image-gd.jpg";
$cropStartX = $_POST['sx'];
$cropStartY = $_POST['sy'];
$cropW = $_POST['ex'];
$cropH = $_POST['ey'];
// création des deux images temporaires
$origimg = imagecreatefromjpeg($imgfile);
$cropimg = imagecreatetruecolor($cropW,$cropH);
// résolution de l'image
list($width, $height) = getimagesize($imgfile);
// Crop
imagecopyresized($cropimg, $origimg, 0, 0, $cropStartX, $cropStartY, $width, $height, $width, $height);
// copie vers répertoire
imagejpeg($cropimg, $dest_small, 80);
// Début du redimensionnement
$thumb = imagecreatetruecolor(100, 100);
$source = imagecreatefromjpeg($dest_small);
imagecopyresized($thumb, $source, 0, 0, 0, 0, 100, 100, $cropW, $cropH);
// copie vers répertoire
imagejpeg($thumb, $dest_small, 80);
// Fin du redimmensionnement
>
Quelqu'un aurais t'il une idée?
merci d'avance
A voir également:
- Php fonction imagecreatefromjpeg
- Fonction si et - Guide
- Easy php - Télécharger - Divers Web & Internet
- Fonction miroir - Guide
- Fonction moyenne excel - Guide
- Expert php pinterest - Télécharger - Langages
1 réponse
As tu regardé sur la doc PhP.net https://www.php.net/manual/fr/function.imagecreatefromjpeg.php , il peut y avoir plusieurs causes, allow_url_fopen, version de PhP...
Sinon, tu y accèdes en faisant un fopen ?
Sinon, tu y accèdes en faisant un fopen ?