473,406 Members | 2,217 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

How Do I Make The Cropping Of Image ?It Is Not Working.Please Suggest Me

Expand|Select|Wrap|Line Numbers
  1. <script>
  2. function onFileLoad(e) {
  3.    var sradha =  $('#cropbox').html('<img src="'+e.target.result +'"/>');
  4.    alert(sradha);
  5.  
  6. }
  7.  
  8. function displayPreview(files) {
  9.     var reader = new FileReader();
  10.     reader.onload = onFileLoad;
  11.     reader.readAsDataURL(files[0]);
  12. }
  13. </script>
  14. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
  15. <script src="js/jquery.min.js"></script>
  16. <script src="js/jquery.Jcrop.js"></script>
  17. <link rel="stylesheet" href="css/demos.css" type="text/css" />
  18. <link rel="stylesheet" href="css/jquery.Jcrop.css" type="text/css" />
  19. <script type="text/javascript">
  20.  
  21.                   $(function(){
  22.  
  23.                     $('#cropbox').Jcrop({
  24.                       aspectRatio: 1,
  25.                       onSelect: updateCoords
  26.  
  27.                     });
  28.  
  29.                   });
  30.  
  31.                   function updateCoords(c)
  32.                   {
  33.                     $('#x').val(c.x);
  34.                     $('#y').val(c.y);
  35.                     $('#w').val(c.w);
  36.                     $('#h').val(c.h);
  37.  
  38.                   };
  39.  
  40.                   function checkCoords()
  41.                   {
  42.                     if (parseInt($('#w').val())) return true;
  43.                     alert('Please select a crop region then press submit.');
  44.                     return false;
  45.                   };
  46.  
  47.                 </script>
  48. <body style="text-align:center; margin-top:50px; width:50%;">
  49. <form action="" method="post" enctype="multipart/form-data" >
  50. <fieldset style="text-align:center; height:200px; color:#0000FF; height:200%; width:188%">
  51. <legend style="border: #0000CC 1px solid;"> Upload Image</legend>
  52. <table width="200" border="0" align="center" cellpadding="6px">
  53.   <tr>
  54.     <td height="20px;">Image</td>
  55.     <br/>
  56.     <td><input type="file" name="image" id="image" onChange="displayPreview(this.files);"/>
  57.     </td>
  58.   </tr>
  59.   <td id="abc"></td>
  60. </table>
  61. <br/>
  62. <input type="submit" value="submit" name="submit">
  63. <br/>
  64. <div  class="imagem_artigo" id="cropbox"></div>
  65.  
  66. <!--<img class='imagem_artigo' src="Lighthouse.jpg" id="cropbox" /> -->
  67. <form action="form.php" method="post" onSubmit="return checkCoords();" enctype="multipart/form-data" >
  68.   <input type="text" id="x" name="x" />
  69.   <input type="text" id="y" name="y" />
  70.   <input type="text" id="w" name="w" />
  71.   <input type="text" id="h" name="h" />
  72.   <input type="submit" value="Crop Image" class="btn btn-large btn-inverse" name="submit" />
  73. <!--  <div id="sradha"> <img class='imagem_artigo' src="Lighthouse1.jpg"   /> </div>-->
  74. </form>
  75. <br>
  76. <br>
  77. </fieldset>
  78. </form>
  79. </body>
Dec 10 '14 #1
1 1437
Dormilich
8,658 Expert Mod 8TB
please describe how it is not working.
Dec 10 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: santanu | last post by:
Hi all, I know a little python (not the OOP part) learnt by studying the online tutorial. Now I would like to learn it more thoroughly. I have access to 'Programming Python' which I liked...
1
by: Support | last post by:
We are a large organization with a number of offices all over the state. All our employees need to access data/update data and generate reports from all offices. Initially our application will...
2
by: anton.aleksandrov | last post by:
Hello, First of all - sorry for may be stupid question, but as I am not a Win* administrator and my field is *nix, I am a little bit stuck with a problem, presented to me by one of the customers....
3
by: ashutosh | last post by:
I am working for a company and working for printer drivers. Most of the work is in ddk, VC++ and C++, gdi calls. I have studied C++ and ddk and VC++ is new for me. Can anybody suggest me some good...
3
by: srikar | last post by:
Hi can any one tell me If we want to print the adress of the object if I type cast in to int on a machine where address and int occupies same size it is not be a problem. If on a machine where...
2
by: astarter | last post by:
Hello friends. I am second year student of Computer engg. in DCE. I want to make some project to hone my programming skills. Please suggest some. I know C,C++, Java( core only) and DS. Any help...
2
by: only2gayathri | last post by:
Hi all, I have a page(vb.net) which directs to a excel sheet.This excel sheet retains all the values(mainly numbers) from the page and displays it.The problem is that sometimes the number's...
2
by: nethravathy | last post by:
Hi, The following table namely elcbtripselect contains 5147 records.I want to know wether this table contains duplicate records or not. I tried with following query 1)SELECT...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.