gergy008 Posted December 16, 2009 Share Posted December 16, 2009 Ok, A few questions here. 1. What function do I need to convert any file into PNG format? 2. Then how do I resize it to fit in a box 200 x 200, But make sure it keeps it's size ratio? 3. Then how do I get a file from the a form already made? The form is <form id="Upload" action="<?php echo $uploadHandler ?>" enctype="multipart/form-data" method="post"> <p class="nolink"> <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_file_size ?>"> </p> <p class="nolink"> <label for="file">File to upload:</label> <input id="file" type="file" name="file"> </p> <p class="nolink"> <label for="submit">Press to...</label> <input id="submit" type="submit" name="submit" value="Upload me!"> </p> </form> Please don't do it for me, Just so I know how, I've never done image manipulation before, I'm new to that but old to everything else Thanks in advance!! Link to comment https://forums.phpfreaks.com/topic/185401-php-image-handling-questions/ Share on other sites More sharing options...
mrMarcus Posted December 16, 2009 Share Posted December 16, 2009 1. list of some applicable functions: imagecreatetruecolor, imagecreatefromjpeg, imagecreatefromgif, imagecreatefrompng, imagecopyresampled, imagepng 2. <?php $image = '/path/to/your-image.whatever'; #final image width; $modwidth = 200; #image options; list ($width, $height, $type) = getimagesize( $image ); #do some math; $diff = ($width / $modwidth); #get new height; $modheight = ($height / $diff); #add width and height; $image = imagecreatetruecolor($modwidth, $modheight); ?> 3. $_FILES['file']['name/tmp_name/size/etc'] (name, tmp_name, size, etc., are respective attributes to the $_FILES array .. use individually, not how i displayed. Link to comment https://forums.phpfreaks.com/topic/185401-php-image-handling-questions/#findComment-978756 Share on other sites More sharing options...
gergy008 Posted December 16, 2009 Author Share Posted December 16, 2009 <?php $image = '/path/to/your-image.whatever'; #final image width; $modwidth = 200; #image options; list ($width, $height, $type) = getimagesize( $image ); #do some math; $diff = ($width / $modwidth); #get new height; $modheight = ($height / $diff); #add width and height; $image = imagecreatetruecolor($modwidth, $modheight); ?> Thanks so much!! Just a question, Is it an absolute path ( "home/gergy008/public_html...etc etc" ) on that script? Or is it just like "images/image.png" Link to comment https://forums.phpfreaks.com/topic/185401-php-image-handling-questions/#findComment-978760 Share on other sites More sharing options...
mrMarcus Posted December 16, 2009 Share Posted December 16, 2009 depends on your server configuration, but this should work: <?php $image = $_SERVER['DOCUMENT_ROOT'] .'/path/to/your/file.something'; ?> this might translate into: C:/home/something/public_html/path/to/your/file.something where something is often a username of some sorts. i usually set my paths like this to avoid any complications. Link to comment https://forums.phpfreaks.com/topic/185401-php-image-handling-questions/#findComment-978763 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.