problemen met imagepng(imagecreatefromstring())

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Ralph van der Tang

ralph van der Tang

30/05/2013 14:06:48
Quote Anchor link
hoi iedereen,

ik ondervind problemen met het volgende stukje php :
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php

// path voor de geresizede img.
                            $resized_path=Settings::$include_path."/uploaded/avatar_realsize/test/avatar/";
                            //public static function resizeImage($originalImage,$type,$toWidth,$toHeight)
                            
                            // small 50px x 50px

                            $small=image::resizeImage($path.$user_id.".png","png",50,50);
                            imagepng(imagecreatefromstring(file_get_contents($small)), $resized_path.$user_id."_small.png");
                            
                            // medium 100x100
                            $medium=image::resizeImage($path.$user_id.".png","png",100,100);
                            imagepng(imagecreatefromstring(file_get_contents($medium)), $resized_path.$user_id."_medium.png");
                            
                            // large 250x250
                            $large=image::resizeImage($path.$user_id.".png","png",250,250);
                            imagepng(imagecreatefromstring(file_get_contents($large)), $resized_path.$user_id."_large.png");
                            echo json_encode(array("success"=> true));

?>


de errors die ik krijg zijn de volgende:
<br />
<b>Warning</b>: file_get_contents() expects parameter 1 to be a valid path, resource given in <b>D:\Program Files\devel\xampp\htdocs\git\Business-leaders\controller\adminajax_controller.php</b> on line <b>1436</b><br />
<br />
<b>Warning</b>: imagecreatefromstring(): Empty string or invalid image in <b>D:\Program Files\devel\xampp\htdocs\git\Business-leaders\controller\adminajax_controller.php</b> on line <b>1436</b><br />
<br />
<b>Warning</b>: imagepng() expects parameter 1 to be resource, boolean given in <b>D:\Program Files\devel\xampp\htdocs\git\Business-leaders\controller\adminajax_controller.php</b> on line <b>1436</b><br />
<br />
<b>Warning</b>: file_get_contents() expects parameter 1 to be a valid path, resource given in <b>D:\Program Files\devel\xampp\htdocs\git\Business-leaders\controller\adminajax_controller.php</b> on line <b>1440</b><br />
<br />
<b>Warning</b>: imagecreatefromstring(): Empty string or invalid image in <b>D:\Program Files\devel\xampp\htdocs\git\Business-leaders\controller\adminajax_controller.php</b> on line <b>1440</b><br />
<br />
<b>Warning</b>: imagepng() expects parameter 1 to be resource, boolean given in <b>D:\Program Files\devel\xampp\htdocs\git\Business-leaders\controller\adminajax_controller.php</b> on line <b>1440</b><br />
<br />
<b>Warning</b>: file_get_contents() expects parameter 1 to be a valid path, resource given in <b>D:\Program Files\devel\xampp\htdocs\git\Business-leaders\controller\adminajax_controller.php</b> on line <b>1444</b><br />
<br />
<b>Warning</b>: imagecreatefromstring(): Empty string or invalid image in <b>D:\Program Files\devel\xampp\htdocs\git\Business-leaders\controller\adminajax_controller.php</b> on line <b>1444</b><br />
<br />
<b>Warning</b>: imagepng() expects parameter 1 to be resource, boolean given in <b>D:\Program Files\devel\xampp\htdocs\git\Business-leaders\controller\adminajax_controller.php</b> on line <b>1444</b><br />

lijkt erop dat er iets fout gaat bij het ophalen van het plaatje

Toevoeging op 30/05/2013 14:58:31:

schijnt dat ik gebruik moet maken van de functie imagecopyresampled
 
Er zijn nog geen reacties op dit bericht.



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.