kristofferlc Posted January 9, 2008 Share Posted January 9, 2008 I'm trying to make a thumb image and a bigger image for a gallery with a function so i can repeat the code more than once at the same page. I cant seem to make it work, and i dont know what i'm doing wrong. :-\ I'm not very known with functions, but realy need this to work... And yes i do have the GD lib instaled... The code goes: // Image function function handleImage($imagepath, $new_width, $new_height, $img_nr, $main_nr) { $image = open_image($imagepath); // Find width and height for original image $width = imagesx($image); $height = imagesy($image); // Resample sub $image_resized = imagecreatetruecolor($new_width, $new_height); imagecopyresampled($image_resized, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); // Save resized image sub imagejpeg($image_resized, $main_nr . '/' . $img_nr . '_sub.jpg', 95); // Big width and size $new_height_big = "500"; $new_width_big = $width * ($new_height_big/$height); // Resamble big $image_resized2 = imagecreatetruecolor($new_width_big, $new_height_big); imagecopyresampled($image_resized2, $image, 0, 0, 0, 0, $new_width_big, $new_height_big, $width, $height); // Save resized image sub imagejpeg($image_resized2, $main_nr . '/' . $img_nr . '_big.jpg', 95); } And this is how i call the function: handleImage($_FILES['billede1']['tmp_name'], 100, 80, 1, $nr); I've been looking trough it alot of times but still miss my error... ??? If anyone can help me i'll be verry greatfull. Quote Link to comment https://forums.phpfreaks.com/topic/85144-what-am-i-doing-wrong/ Share on other sites More sharing options...
aschk Posted January 9, 2008 Share Posted January 9, 2008 Are you getting any error output? Quote Link to comment https://forums.phpfreaks.com/topic/85144-what-am-i-doing-wrong/#findComment-434381 Share on other sites More sharing options...
kristofferlc Posted January 9, 2008 Author Share Posted January 9, 2008 No, nothing but a 500 http error, witch aint to much help. (Only tells you there's a programing error...) Quote Link to comment https://forums.phpfreaks.com/topic/85144-what-am-i-doing-wrong/#findComment-434385 Share on other sites More sharing options...
kristofferlc Posted January 9, 2008 Author Share Posted January 9, 2008 In case anyone cares. When i put out dg_info() i get this in return: array(12) { ["GD Version"]=> string(27) "bundled (2.0.34 compatible)" ["FreeType Support"]=> bool(true) ["FreeType Linkage"]=> string(13) "with freetype" ["T1Lib Support"]=> bool(true) ["GIF Read Support"]=> bool(true) ["GIF Create Support"]=> bool(true) ["JPG Support"]=> bool(true) ["PNG Support"]=> bool(true) ["WBMP Support"]=> bool(true) ["XPM Support"]=> bool(true) ["XBM Support"]=> bool(true) ["JIS-mapped Japanese Font Support"]=> bool(false) } Quote Link to comment https://forums.phpfreaks.com/topic/85144-what-am-i-doing-wrong/#findComment-434416 Share on other sites More sharing options...
kristofferlc Posted January 9, 2008 Author Share Posted January 9, 2008 Are there realy no one that have any sugestions? Quote Link to comment https://forums.phpfreaks.com/topic/85144-what-am-i-doing-wrong/#findComment-434622 Share on other sites More sharing options...
kristofferlc Posted January 10, 2008 Author Share Posted January 10, 2008 This is odd... I seem to have found a part of the problem... I think... See, if i only try to upload (and resize) one image, it works, but as soon as i bring more than one image into the code, like here, it messes up... To me it looks like i can only handle one image at the time, witch anoys me, is there a way to solve this? (I've tryed imagedestroy() but it didnt work.) Quote Link to comment https://forums.phpfreaks.com/topic/85144-what-am-i-doing-wrong/#findComment-435079 Share on other sites More sharing options...
teng84 Posted January 10, 2008 Share Posted January 10, 2008 what specifically the error you're getting Quote Link to comment https://forums.phpfreaks.com/topic/85144-what-am-i-doing-wrong/#findComment-435087 Share on other sites More sharing options...
kristofferlc Posted January 10, 2008 Author Share Posted January 10, 2008 The only error i've got so far is a 500 http error in the browser, witch only tells me that there sould be a programing error or that the page is under an update... I dont know if there's some other error i can make it show with a "get_error()" function or something like that, i'm not a super php programer... :-\ Quote Link to comment https://forums.phpfreaks.com/topic/85144-what-am-i-doing-wrong/#findComment-435092 Share on other sites More sharing options...
kristofferlc Posted January 10, 2008 Author Share Posted January 10, 2008 I'm verry sorry, but i have to leave for today, but i still hope to get some help. I'll be back tomorrow. Quote Link to comment https://forums.phpfreaks.com/topic/85144-what-am-i-doing-wrong/#findComment-435096 Share on other sites More sharing options...
revraz Posted January 10, 2008 Share Posted January 10, 2008 You post pretty early, so don't expect too much help at around 12am-8am Quote Link to comment https://forums.phpfreaks.com/topic/85144-what-am-i-doing-wrong/#findComment-435102 Share on other sites More sharing options...
kristofferlc Posted January 10, 2008 Author Share Posted January 10, 2008 Sorry, but that's when i'm awake, i live in europe, so... Quote Link to comment https://forums.phpfreaks.com/topic/85144-what-am-i-doing-wrong/#findComment-435446 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.