Wpis z mikrobloga

$source = $this->loadImg($link);
$rotate = imagerotate($source,$rotate_angle,0);
imagejpeg($rotate);
imagedestroy($source);
imagedestroy($rotate);

**Warning**: imagerotate() expects parameter 1 to be resource, boolean given in **/classes/Rotate.php** on line **72**
Nie wiem dlaczego, ale wywala mi taki błąd :/ $source dobrze się ładuje, ale tutaj nie mam pojęcia dlaczego jest błąd :/

#php #webdev #programowanie
  • 6
@niewiemcotuwpisac: @zolwixx:

Takie coś zwraca $source = $this->loadImg($link);

a loadImg to

function loadImg($link) {
$ch = curl_init();

curl_setopt ($ch, CURLOPT_URL, $link);
curl_setopt ($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt ($ch, CURLOPT_HEADER, false);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 0);

$rawData = curl_exec($ch);
$image = imagecreatefromstring($rawData);

curl_close($ch);

return imagejpeg($image);
}
Pobierz jaskowice1 - @niewiemcotuwpisac: @zolwixx: 

Takie coś zwraca $source = $this->load...
źródło: comment_bMcLbf5jvkBqQzb6kh6EalCkayRZijft.jpg
@zolwixx: Ok, już nie ma tego błędu, ale teraz jest coś takiego: resource(13) of type (Unknown)
resource(14) of type (Unknown)

$source = $this->loadImg($link);
$rotate = imagerotate($source,$rotate_angle,0);
// Output
imagejpeg($rotate);

// Free the memory
imagedestroy($source);
imagedestroy($rotate);

To jest w ogóle dobrze?