![]() I uploaded it onto my host’s server so I could figure out how to fix it while still using that function >.< Anyways, like I said, not giving any errors, but it’s still not working. Okay, well, it took me to the next page without displaying any errors, but it’s still not working… All it gives me for the thumbnail is a black box… function makeThumbnail($originalImage, $username) ![]() Under the notes, but I tried that and it did not work x_x There was a suggestion on how to fix it, here: $thumbnail = imagecopyresampled($thumbie, $original, 0, 0, 0, 0, $nw, $nh, $ow, $oh) įatal error: Call to undefined function exif_imagetype() $thumbie = imagecreatefromjpeg($thumbnailName) $original = imagecreatefromwbmp($originalImage) $original = imagecreatefrompng($originalImage) $original = imagecreatefromjpeg($originalImage) $original = imagecreatefromgif($originalImage) when i used absolute path for the require(), page1.php now displays index.php, with the rest of page1.php below it. $mimetype = exif_imagetype($originalImage) in page1.php i have require (init.php) which checks if user is logged in, if not, redirects to index.php. Okay, so I tried the suggestions, and I now have this (note the switch statement): function makeThumbnail($originalImage, $username) Line 63 is the one with the imagecopyresampled function on it. Warning: imagecopyresampled(): supplied argument is not a valid Image resource in \ on line 63 The first two image functions I used work how they’re suppose to (I checked the folder and found the black rectangle jpeg). The $originalImage is the url to an image that was uploaded and moved to it’s appropriate directory. This function can be found in any PHP version similar or greater than 5.2.0. Many people have suggested the use of getimagesize() which returns an array if the file is indeed an image and false otherwise, but exifimagetype() is much faster. $thumbnail = imagecopyresampled($thumbnailName, $originalImage, 0, 0, 0, 0, $nw, $nh, $ow, $oh) The imagetypetoextension () function is an inbuilt function in PHP which is used to get the file extension for an image type. My best bet would be for you to check the extension of the file and using exifimagetype() to check for valid images. errors : Undefined array key gender in C:laragonphp databse store data error :( errors. If (!imagejpeg($thumbie, $thumbnailName)) $thumbie = imagecreatetruecolor($nw, $nh) $dimensions = getimagesize($originalImage) ![]() $originalImageName = substr_replace($originalImage, '', 0, $removelen) Okay, so I am trying to write a function for making thumbnails, here’s the function (you can ignore all the string functions, that all works properly): function makeThumbnail($originalImage, $username)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |