Advertisement
Guest User

Image Uploader and Aviary Editer

a guest
Sep 20th, 2013
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.81 KB | None | 0 0
  1.  
  2. <?php
  3.  
  4. $submit=$_POST['sub'];
  5. if(isset($submit))
  6. {
  7. $name=$_FILES['img']['name'];
  8. $type=$_FILES['img']['type'];
  9.  
  10. $size=($_FILES['img']['size'])/1024;
  11.  
  12. $ext=end(explode('.',$name));
  13. if (($ext == "gif")
  14. || ($ext == "jpeg")
  15. || ($ext == "jpg")
  16. || ($ext =="png")
  17. && ($size > 30))
  18. {
  19.  
  20.  
  21. ############################## File Renaming ###################################################
  22.  
  23. $newname=uniqid();
  24. //$ext=end(explode('.',$name));
  25. $fullname=$newname.".".$ext;
  26. $target="pics/";
  27. $fulltarget=$target.$fullname;
  28. if(move_uploaded_file($_FILES['img']['tmp_name'],$fulltarget))
  29. {
  30. echo "Success";
  31. }
  32. else
  33. {
  34. echo "Failed";
  35. }
  36. ############################## File Renaming end ###################################################
  37. }
  38. else{
  39. echo "not successful";
  40. }
  41. }
  42. ?>
  43.  
  44. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  45. <html xmlns="http://www.w3.org/1999/xhtml">
  46. <head>
  47. <link rel="stylesheet" type="text/css" href="abhi.css" />
  48. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  49. <title>Php Image Uploader</title>
  50. </head>
  51.  
  52. <body>
  53. <div id="a1">
  54. <form name="frm" method="post" enctype="multipart/form-data">
  55. <input type="file" name="img" /><br />
  56.  
  57. <input type="submit" name="sub" value="Store" />
  58. </form>
  59. </div>
  60. <div id="a2">
  61.  
  62. <?php echo "
  63. <html>
  64. <head>
  65. <title>Aviary Photo Editer</title>
  66. <!-- Load Feather code -->
  67. <script type='text/javascript' src='http://feather.aviary.com/js/feather.js'></script>
  68. <!-- Instantiate Feather -->
  69. <script type='text/javascript'>
  70. var featherEditor = new Aviary.Feather({
  71. apiKey: 'ceegvx4siylhayrr',
  72. apiVersion: 3,
  73. theme: 'dark', // Check out our new 'light' and 'dark' themes!
  74. tools: 'enhance,frames,crop,orientation,brightness,saturation,sharpness,draw,redeye,blemish,effects,stickers,resize,focus,contrast,warmth,colorsplash,text,whiten',
  75. appendTo: '',
  76. onSave: function(imageID, newURL) {
  77. var img = document.getElementById(imageID);
  78. img.src = newURL;
  79. },
  80. onError: function(errorObj) {
  81. alert(errorObj.message);
  82. }
  83. });
  84. function launchEditor(id, src) {
  85. featherEditor.launch({
  86. image: id,
  87. url: src
  88. });
  89. return false;
  90. }
  91. </script>
  92. </head>
  93.  
  94. <body>
  95.  
  96. <div id='injection_site'></div>
  97.  
  98. <img id='image1' src='$fulltarget'/>
  99.  
  100. <p><input type='image' src='http://images.aviary.com/images/edit-photo.png' value='Edit photo' onclick="return launchEditor('image1', '$fulltarget');" /></p>";
  101.  
  102. ?>
  103.  
  104.  
  105. </body>
  106. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement