Jump to content

aNubies

Members
  • Posts

    31
  • Joined

  • Last visited

Everything posted by aNubies

  1. Sir Barand, I saw a convertbmptogd function yet it won't recognize the .pix file. Do you have any other way how to read the color values of the .pix file?
  2. Okay barand, I'm gonna give it a shot. Thank you.
  3. Alright im testing the imagecreatefromstring() function, but it always give me an error saying "data is not recognized format". This is base on my previous post that what i want to do is convert my .pix file which is a map file into a jpeg file. I tried to read the stream before converting it into the function but no luck, same with file_get_contents but no luck also. Help here please. Thank you in advance.
  4. wow that's great barand, you got a very useful info there . Thank you.
  5. Well you give me a lot of references there sire , gonna check the documentation of every each and decide what could be use.
  6. Sorry for the late reply, no convertion at all, I want to do it the same with my png and jpg function which is re-scale and reduce quality only, but this time in .pix image file.
  7. Okay, now my mind is open with imagecreafrom (png, jpeg, gif) function of PHP. But i'm curious does it support other image format? ofcourse it is a very obvious question seeing those 3 are the only available function, but this is just curiosity. Since I'm planning to reduce and re-scale a sattelite image which is in ".pix" format a type of image file but with a different format. So is it possible? Those who work in maps, satellites is very much appreciated or anyone . Thank you very much in advance.
  8. well, thank you haku for the info, you've anwer my question since i have a feeling that seeing my source code, javascript seems unable to call the php second time around. Thank you again haku.
  9. Here's my current code. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> Reduce & Resize Images </title> <?php function CheckDirectory() { $netDir = "Network_Images/*.png"; $locDir = "Local_Images/"; foreach (glob($netDir) as $net) { $files = glob($locDir."/".substr($net, strpos($net, "/") + 1)); if (empty($files)) { $im = imagecreatefrompng($net); $new_image = imagecreatetruecolor(50, 50); imagecopyresampled($new_image, $im, 0, 0, 0, 0, 50, 50, imagesx($im), imagesy($im)); $im = $new_image; imagepng($im, $locDir.substr($net, strpos($net, "/") + 1), 0); } } } ?> <script type="text/javascript"> function init() { console.log("timeout called"); document.write("<?php CheckDirectory(); ?>"); t = setTimeout(function() {init()}, 30000); } </script> </head> <body onload="init()"> <form action="" method="POST" enctype="multipart/form-data"> <label name="lblBrowser">Filename : </label> <input type="file" name="fileUpload" id="fileUpload" /><br /> <input type="submit" value="Upload" id="Upload" /> </form> </body> </html>
  10. Yeah I recently use the format that you've given to me Sir Haku, however; the console says CheckDirectory is not defined and it doesn't execute at all.
  11. Okay after observing something in console and page source, looks like the reason is that after executing it once the source turns into this <document.write("");> at first <document.write("phpcode");> and it turns into nothing. Is it saying that javascript cannot run server side code, but instead use AJAX? Anyone please help me out here.
  12. Sorry, never knew about console.log, but anyway, i just tested it and it says CheckDirectory not defined. So i place it back in php tag and re-run it, and it works fine however only once not with the desire every 30secs count.
  13. Thank you for the response, but it doesn't work.
  14. removing the exit(); doesn't make any changes, still it execute once.
  15. Nope not yet, the code above just executed once, thinking of my code it should be execute every base time set in setTimeout(), but it didn't.
  16. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> Reduce & Resize Images </title> <?php function CheckDirectory() { $netDir = "Network_Images/*.png"; $locDir = "Local_Images/"; foreach (glob($netDir) as $net) { $files = glob($locDir."/".substr($net, strpos($net, "/") + 1)); if (empty($files)) { $im = imagecreatefrompng($net); $new_image = imagecreatetruecolor(50, 50); imagecopyresampled($new_image, $im, 0, 0, 0, 0, 50, 50, imagesx($im), imagesy($im)); $im = $new_image; imagepng($im, $locDir.substr($net, strpos($net, "/") + 1), 0); } } exit(); } ?> <script type="text/javascript"> function init() { document.write("<?php CheckDirectory(); ?>"); t = setTimeout(function() {init()}, 30000); } </script> </head> <body onload="init()"> <form action="" method="POST" enctype="multipart/form-data"> <label name="lblBrowser">Filename : </label> <input type="file" name="fileUpload" id="fileUpload" /><br /> <input type="submit" value="Upload" id="Upload" /> </form> </body> </html> Here's the corrected CheckDrirectory->CheckDirectory.
  17. Well CheckDirectory() function does check if the image is exist in the other folder, if its not it will create a copy. So basically i need it to execute continously base on the time i set. The code above just execute at first time around only dunno why. [EDIT] Oh, I see the typo of CheckDirectory spelling, my bad.
  18. Okay, I manage to make a function checkdirectory and execute it using javascript but what i want is execute it base on the time I set. But with my current code it just execute once. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> Reduce & Resize Images </title> <?php function CheckDrirectory() { $netDir = "Network_Images/*.png"; $locDir = "Local_Images/"; foreach (glob($netDir) as $net) { $files = glob($locDir."/".substr($net, strpos($net, "/") + 1)); if (empty($files)) { $im = imagecreatefrompng($net); $new_image = imagecreatetruecolor(50, 50); imagecopyresampled($new_image, $im, 0, 0, 0, 0, 50, 50, imagesx($im), imagesy($im)); $im = $new_image; imagepng($im, $locDir.substr($net, strpos($net, "/") + 1), 0); } } exit(); } ?> <script type="text/javascript"> function RepeatingText() { document.write("<?php CheckDrirectory(); ?>"); t = setTimeout(function() {RepeatingText()}, 30000); } </script> </head> <body onload="RepeatingText()"> <form action="" method="POST" enctype="multipart/form-data"> <label name="lblBrowser">Filename : </label> <input type="file" name="fileUpload" id="fileUpload" /><br /> <input type="submit" value="Upload" id="Upload" /> </form> </body> </html> Please point me out on how to execute it continously.
  19. I got it, I just changed the upload_max_limit configuration of PHP, by default it is 2MB. Thank you very much for the responses .
  20. If I directly put the path of the file in the imagecreatefrompng() it works but via file input it doesn't if its more than 2mb.
  21. Great, now I just tried that and the error dissapear also. But now I got this error With some observation file input seems cannot upload exact or more than 2mb image. I've search Mr. Google about it and it gave me data-max-size and max-size attributes but it didn't work, do you know Sir Haku if theres a way around on how to manage the upload of file input? Thank you in advance. [Edit] can - cannot
  22. Sorry I just changed the file input field name into 'fileUploads', but to make it more clearer let me paste the whole code. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> Reduce & Resize Images </title> <?php $im = imagecreatefrompng($_FILES['fileUploads']['tmp_name']); imagepng($im, $_FILES['fileUploads']['name'], 9); ?> </head> <body> <form action="" method="POST" enctype="multipart/form-data"> <label name="lblBrowser">Filename : </label> <input type="file" name="fileUploads" id="fileUploads" /><br /> <input type="submit" name="Upload" value="Upload" /> </form> </body> </html>
  23. Thank you very much sir for the quick response, but I'm afraid thats the only error that I got. Now I got a new error here is the complete error.
  24. Guys help here please, this driving me crazy. At first I'm working with this code its running fine, however for some unknown reason it keeps telling me this error now "Unidentified Index". $im = imagecreatefrompng($_FILES['fileUpload']['tmp_name']); imagepng($im, $_FILES['fileUpload']['name'], 9); the above code is what I'm working it is place in <head> tag, I'm just testing the code so thats the only code there. why is that Unidentified index then, please help need a quick response. Thank you in advance.
  25. Hi again guys , alright I'm close to finish my exercise. This time what I want to know is is it possible to continously check a directory for any changes (changes means if the count of files where decrease or increase)? How to put it into a clock or something using PHP. Or I need to use some sort of javascript?. Please show me how. Thank you very much in advance.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.