Jump to content

johnrb87

Members
  • Posts

    92
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

johnrb87's Achievements

Member

Member (2/5)

0

Reputation

  1. solved, thanks
  2. the javascript used is //Only display the javacript if an image has been uploaded $current_large_image_width = getWidth($large_image_location); $current_large_image_height = getHeight($large_image_location);?> <script type="text/javascript"> function preview(img, selection) { var scaleX = <?php echo $thumb_width;?> / selection.width; var scaleY = <?php echo $thumb_height;?> / selection.height; $('#thumbnail + div > img').css({ width: Math.round(scaleX * <?php echo $current_large_image_width;?>) + 'px', height: Math.round(scaleY * <?php echo $current_large_image_height;?>) + 'px', marginLeft: '-' + Math.round(scaleX * selection.x1) + 'px', marginTop: '-' + Math.round(scaleY * selection.y1) + 'px' }); $('#x1').val(selection.x1); $('#y1').val(selection.y1); $('#x2').val(selection.x2); $('#y2').val(selection.y2); $('#w').val(selection.width); $('#h').val(selection.height); } $(document).ready(function () { $('#save_thumb').click(function() { var x1 = $('#x1').val(); var y1 = $('#y1').val(); var x2 = $('#x2').val(); var y2 = $('#y2').val(); var w = $('#w').val(); var h = $('#h').val(); if(x1=="" || y1=="" || x2=="" || y2=="" || w=="" || h==""){ alert("You must make a selection first"); return false; }else{ return true; } }); }); $(window).load(function () { $('#thumbnail').imgAreaSelect({ aspectRatio: '1:<?php echo $thumb_height/$thumb_width;?>', onSelectChange: preview }); });
  3. Hi I have a javascript image cropping script which is working well, I then have some php to save the new cropped image. But I can't seem to get it working 100%. When the form is posted the cropped image is not created and I get a "The connection was reset" error. If I comment out the line $source=imagecreatefromjpeg($image); then I dont get the The connection was reset" error but the image is obviously still not created. Can anyone help? <?php function resizeThumbnailImage($thumb_image_name, $image, $width, $height, $start_width, $start_height, $scale){ list($imagewidth, $imageheight, $imageType) = getimagesize($image); $imageType = 'image/jpeg'; $newImageWidth = ceil($width * $scale); $newImageHeight = ceil($height * $scale); $newImage = imagecreatetruecolor($newImageWidth,$newImageHeight); switch($imageType) { case "image/jpeg": case "image/jpg": $source=imagecreatefromjpeg($image); break; } imagecopyresampled($newImage,$source,0,0,$start_width,$start_height,$newImageWidth,$newImageHeight,$width,$height); switch($imageType) { case "image/jpeg": case "image/jpg": imagejpeg($newImage,$thumb_image_name,90); break; } chmod($thumb_image_name, 0777); return $thumb_image_name; } function getHeight($image) { $size = getimagesize($image); $height = $size[1]; return $height; } function getWidth($image) { $size = getimagesize($image); $width = $size[0]; return $width; } $large_image_location = $upload_path.$large_image_name.'.jpg'; $thumb_image_location = $upload_path.$thumb_image_name.'.jpg'; if (isset($_POST["upload_thumbnail"])) { $x1 = $_POST["x1"]; $y1 = $_POST["y1"]; $x2 = $_POST["x2"]; $y2 = $_POST["y2"]; $w = $_POST["w"]; $h = $_POST["h"]; $scale = $thumb_width/$w; $cropped = resizeThumbnailImage($thumb_image_location, $large_image_location,$w,$h,$x1,$y1,$scale); header("location:index.php"); exit(); } ?>
  4. thanks, lastname is an empty string value
  5. any ideas anyone??
  6. Nope that didn't seem to work, thanks for taking time to suggest somethings
  7. that doesn't seem to sort it into date order, it keeps rows with no value for `lastname` at the bottom of the list (which is what I need), but it doesn't sort it correctly into date order as it returns 2011-08-05 19:19:25 2011-08-05 19:16:29 2011-08-06 00:41:01 2011-08-05 21:52:17 any ideas why? thanks
  8. Hi all I have a database table which has the following fields; department | firstname | lastname | mydatetime I run the following QUERY at the moment SELECT * FROM `users` ORDER BY lastname DESC I do this type of "ORDER BY" to ensure that anyone who has an empty value for `lastname` appears at the bottom of the list and anyone who has a value for `lastname` would appear at the top of the list What I am stuck with is, I need to keep the query the same (ie: anyone who has a empty value for `lastname` is at the bottom), but I want to order the results by `mydatetime` which is a datetime value written like "2011-07-20 10:20:45" So it would keep rows with no value for `lastname` at the bottom, but it would order all the results using the datetime field `mydatetime` Anyone got any ideas?
  9. Hi Is it possible with the form below <form method="post" name="people" id="people"> <input name="name" id="name"> <select name="location" id="location"> <option value="send_user.php">user</option> <option value="send_staff.php">staff</option> </form> to post the form to the selected URL from the list. So if I select "user", the form will post to "send_user.php" and if I select "staff", the form will post to "send_staff.php" Thanks
  10. does anyone know of a php hotmail email address importer? i have found loads of scripts online, but they are all old and it seems hotmail changed the way in which you fetch data a while ago and I cannot seem to find anything which works with the current method. thanks
  11. Hi I have the following allowed in my regex validation var regex = /[a-zA-Z0-9]+/; how can I extend that to allow hyphens, underscores and spaces only? thanks
  12. Ok, I built into my query CURDATE(), (YEAR(CURDATE())-YEAR(staff.dob)) - (RIGHT(CURDATE(),5)<RIGHT(staff.dob,5)) AS age which calculates their age, this works ok, but when I try and narrow it down using WHERE age = 50 it returns an error Unknown column 'age' in 'where clause' any idea why?
  13. hi can anyone help me? i have a php form which has 2 fields `age_from` and `age_to` they are both populated with number values (going from 30 to 65). I need to run a query on my database table called `staff` to return those staff members who fall within the age range selected, the only indication of the staff members age is the `dob` field which I also store, and it is in the format "YYYY-MM-DD" can anyone help? im stumped
  14. Hi everyone Apart from using sessions, how can I make a PHP page more secure and protect the SQL database more? Thanks
  15. Hi I have a php script which allows me to upload images to my product page, when I select a image to copy it simply does a copy(); function, followed by a header("Location: products.php"); redirect This all works ok, but when the page reload, the image has not changed, if I refresh the page, it seems to load ok. So I think this is a image caching problem. Any ideas on how to solve this? Thanks
×
×
  • 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.