fife
Members-
Posts
381 -
Joined
-
Last visited
Everything posted by fife
-
ok thanks guys made those changes and left with one error. Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/sites/image.php on line 268 which is now this line..... imagecopyresampled($image_resized, $tmpName, 0, 0, 0, 0, $new_width, $new_height, $width, $height); Here is the ammended code. <?php error_reporting(-1); ini_set('display_errors', 1); if(isset($_POST['submit'])){ $fileName = $_FILES['imagefile']['name']; $tmpName = $_FILES['imagefile']['tmp_name']; //where to save the image $folder = "{$_SERVER['DOCUMENT_ROOT']}/members/images/Merseyside/"; //get original width and height $size = GetImageSize($tmpName); $width = $size[0]; $height = $size[1]; // auto adjust width of image according to predetermined height $new_height = 500; $new_width = $width * ($new_height/$height); // Resample image $image_resized = imagecreatetruecolor($new_width, $new_height); imagecopyresampled($image_resized, $tmpName, 0, 0, 0, 0, $new_width, $new_height, $width, $height); // New image $tmpName= $image_resized; $move = move_uploaded_file($tmpName, $folder.$fileName); if($move) { $url = "/members/clubs/image.php?pic=$image"; header("Location: $url"); } } ?> Ive tried changing imagecopyresampled($image_resized, $tmpName, 0, 0, 0, 0, $new_width, $new_height, $width, $height); to $fileName but that didnt work either.
-
ok here is the new script with my error from the error reporting. I dont understand any of them if(isset($_POST['submit'])){ $fileName = $_FILES['imagefile']['name']; $tmpName = $_FILES['imagefile']['tmp_name']; //where to save the image $folder = "{$_SERVER['DOCUMENT_ROOT']}/members/images/Merseyside/"; //get original width and height $size = @GetImageSize($fileName); $width = $size[0]; $height = $size[1]; // auto adjust width of image according to predetermined height $new_height = 500; $new_width = $width * ($new_height/$height); // Resample image $image_resized = imagecreatetruecolor($new_width, $new_height); imagecopyresampled($image_resized, $fileName, 0, 0, 0, 0, $new_width, $new_height, $width, $height); // New image $image = $image_resized; my errors are Division by zero in /home/sites/image.php on line 264 which is this line......... $new_width = $width * ($new_height/$height); Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in /home/sites/image.php on line 267 which is this line....... $image_resized = imagecreatetruecolor($new_width, $new_height); finally Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/sites/image.php on line 268 which is this line....... imagecopyresampled($image_resized, $fileName, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
-
please ignore or answer on the correct board called coding help
-
OK. I have tried to make my own image upload script which checks if the image is bigger the 500px in height. If it is shrinks the image down then uploads it an saves it to a database. I got the upload an save to database working fine. Once I added the check size bits it just fails with no error. Does anybody know of any simple scripts or tuts out there that do this as Im fed up of banging my head against the wall. Ive tried to find one myself but they dont exist it would seem!! heres my code anyway just incase its fixable.. I get no error an no redirect, I dont think its even making it to the move upload file as its not appearing on my server <?php if(isset($_POST['submit'])){ $fileName9 = trim($_FILES['imagefile']['name']); $tmpName = $_FILES['imagefile']['tmp_name']; $fileType = $_FILES['imagefile']['type']; //re name the image $randName = md5(rand() * time()); $fileName = $randName.$fileName9; //where to save the image $folder = "{$_SERVER['DOCUMENT_ROOT']}/members/images/{$members['county']}/"; //check types $types = array('image/jpeg', 'image/gif', 'image/png', 'image/JPG', 'image/pjpeg', 'image/x-png'); if (in_array($fileType, $types)) { //get original width and height $size = @GetImageSize($fileName); $width = $size[0]; $height = $size[1]; // auto adjust width of image according to predetermined height $new_height = 500; $new_width = $width * ($new_height/$height); // Resample image $image_resized = imagecreatetruecolor($new_width, $new_height); imagecopyresampled($image_resized, $fileName, 0, 0, 0, 0, $new_width, $new_height, $width, $height); // New image $image = $image_resized; } // Your file handing script here if(move_uploaded_file($tmpName , $folder.$image)) { $qInsert = mysql_query("UPDATE `members` SET profilePic = '$image' WHERE userID = '".$members['userID']."'") or die (mysql_error()); } if ($qInsert){ $url = "/members/clubs/image.php?pic=$image"; header("Location: $url"); } } ?> <form action="" method="post" enctype="multipart/form-data" name="photo" id="photo"> <input name="imagefile" type="file"> <input name="submit" type="submit" id="submit"> </form>
-
OK. I have tried to make my own image upload script which checks if the image is bigger the 500px in height. If it is shrinks the image down then uploads it an saves it to a database. I got the upload an save to database working fine. Once I added the check size bits it just fails with no error. Does anybody know of any simple scripts or tuts out there that do this as Im fed up of banging my head against the wall. Ive tried to find one myself but they dont exist it would seem!! heres my code anyway just incase its fixable.. I get no error an no redirect, I dont think its even making it to the move upload file as its not appearing on my server <?php if(isset($_POST['submit'])){ $fileName9 = trim($_FILES['imagefile']['name']); $tmpName = $_FILES['imagefile']['tmp_name']; $fileType = $_FILES['imagefile']['type']; //re name the image $randName = md5(rand() * time()); $fileName = $randName.$fileName9; //where to save the image $folder = "{$_SERVER['DOCUMENT_ROOT']}/members/images/{$members['county']}/"; //check types $types = array('image/jpeg', 'image/gif', 'image/png', 'image/JPG', 'image/pjpeg', 'image/x-png'); if (in_array($fileType, $types)) { //get original width and height $size = @GetImageSize($fileName); $width = $size[0]; $height = $size[1]; // auto adjust width of image according to predetermined height $new_height = 500; $new_width = $width * ($new_height/$height); // Resample image $image_resized = imagecreatetruecolor($new_width, $new_height); imagecopyresampled($image_resized, $fileName, 0, 0, 0, 0, $new_width, $new_height, $width, $height); // New image $image = $image_resized; } // Your file handing script here if(move_uploaded_file($tmpName , $folder.$image)) { $qInsert = mysql_query("UPDATE `members` SET profilePic = '$image' WHERE userID = '".$members['userID']."'") or die (mysql_error()); } if ($qInsert){ $url = "/members/clubs/image.php?pic=$image"; header("Location: $url"); } } ?> <form action="" method="post" enctype="multipart/form-data" name="photo" id="photo"> <input name="imagefile" type="file"> <input name="submit" type="submit" id="submit"> </form>
-
Hi. I have a form on my page that looks like follows...... <div id="login-box"> <a href="javascript:void(0);" class="floatRight" id="closeLink">Close Form</a> <div class="clear"></div><h5 class="floatLeft">New Comment </h5> <div class="clear"></div> <hr> <div id="preview"></div> <form action="submitpost.php" method="post" name="newCommentfrm" id="newCommentfrm"> <ul> <li><label>Comment Type:</label><div class="clear"></div><select name="type"> <option>Please Select</option> <option value="Sightseeing">Sightseeing</option> <option value="Nightlife">Nightlife</option> <option value="Highlights">Highlights</option> <option value="Tips">Tips</option> <option value="Events">Events</option> <option value="News">News</option> <option value="Contrasts">Contrasts</option> <option value="Lifestyle">Lifestyle</option> <option value="Food">Food</option> </select></li> <li><label>Title:</label><div class="clear"></div><input name="ComTitle" type="text" size="40"></li> <li><label>Comment:</label><textarea name="commentDescrip" cols="45" rows="10"></textarea></li> <li><input name="member" type="hidden" value="<?php $row_rs_User['userID'];?>"><input name="submit" type="submit" value="Post Comment"></li> </ul> </form> </div> the form submits to submitpost.php and then refreshes the page with a thankyou message which works great. However the form needs to be a lightbox form which submits without freshing the page. so I then added the lightbox features <script type="text/javascript" src="/js/prototype.js"></script> <script type="text/javascript" src="/js/scriptaculous.js?load=effects,dragdrop"></script> <script type="text/javascript" src="/js/lightbox.js"></script> <script> var test; Event.observe(window, 'load', function () { test = new Lightbox('login-box'); }); Event.observe('lightboxLink', 'click', function () { test.open(); }); Event.observe('closeLink', 'click', function () { test.close(); }); </script> and the submit without refresh <script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#newCommentfrm").validate({ debug: false, submitHandler: function(form) { // do other stuff for a valid form $.post('submitpost.php', $("#newCommentfrm").serialize(), function(data) { $('#preview').html(data); }); } }); }); </script> Now the form submits but actually takes you to the submit.php page and just sits there with the thankyou message without displaying the thankyou in the orginal lightbox div. I hope that makes sense! Here is the code for the submit <?php include('database.php'); if($_SERVER["REQUEST_METHOD"] == "POST") { $type=mysql_real_escape_string($_POST['type']); $title=mysql_real_escape_string($_POST['ComTitle']); $message=mysql_real_escape_string($_POST['commentDescrip']); $member=mysql_real_escape_string($_POST['member']); if(strlen($type)>0 && strlen($title)>0 && strlen($message)>0) { $time=time(); mysql_query("INSERT INTO table (type, title, message,postUserID, time) VALUES('$type','$title','$message','$member', '$time')") or die('post error'); echo "<h2>Thank You !</h2>"; } } ?> I have found that if I remove the lightbox form then the submit without refresh works perfectly but the client has requested the lightbox feature. Can someone please point out my errors. Thank you
-
so this is not possible then as the ID in the data base is not in md5? <?php $ID = md5($ID); $query = mysql_query("SELECT * FROM table WHERE ".md5(tableID)." = $ID"); ?>
-
Sorry for late reply guys. Im in work. Yes when I ran the query I had this error..... Unknown column '8244100d2bc069d6d4c6e3d8f984c6de' in 'where clause'
-
Hi. I have an ID in md5 format but in the database its not. I pass the md5 ID to a page and then I am trying to load the correct record via a look up in the database of that ID. Im wondering is this code possible? <?php $query = mysql_query("SELECT * FROM table WHERE ".md5(tableID)." = $ID"); ?> Thanks
-
yes thankyou the second solution there is perfect.
-
I have a div I want to show but I want to show it if any of the results from a certain part of my query = 1. Here is my code <?php if($country['sightseeing']=='1') || if($country['nightlife']=='1') || if($country['hightlights']=='1') || if($country['tips']=='1') || if($country['events']=='1') || if($country['news']=='1') || if($country['contrasts']=='1') || if($country['lifestyle']=='1') || if($country['food']=='1') || if($country['food']=='1') { //do something } ?> Now I know my sytax here is incorrect but I dont know who you write this any other way. Can somebody please help me. Thanks
-
Hi. I was just wondering if it is possible to write custom mysql errors. I have hunted around for some but cant find any. Currently I write my errors like... or die (mysql_error()); How ever I see this as a problem! As Im not the best coder there are bound to be errors in my code. I dont want somebody who knows what they are doing to cause an error and then doing it (mysql_error()) will point them in the right direction to what I have missed. I would rather have my own error saying what line the issue is with. I have tried..... or die (mysql_error(My personal error here)) However this does not work. Please help. Thank you
-
Submit on enter key and submission confirmation issue
fife replied to fife's topic in Javascript Help
Thank you very very much it works great -
Submit on enter key and submission confirmation issue
fife replied to fife's topic in Javascript Help
Thanks liam. Sorry Im totally new to javascript and was following a tut that obviously didnt understand properly. I thought the submit handler was a function to bring up the dialog box. lol. Thank you for rewriting the code. however it produces the same issue. The form just submits without the confirmation having chance to stop it. -
Hi. I have written my first ever js and to be honest. I can just about read it let alone understand how to fix the error. Basically I want to change details in a field, on pressing the enter key submit the form but so a confirmation dialog before the form actually submits. If all is good submit the actual form. here is my js <script> $(document).ready(function() { $(document).keyup(function(event) { if (event.keyCode == 13) { submitHandler: function( ){ answer = confirm("Are you sure you want to submit?"); if (answer == true){ $("#v21frm").submit(); } else{ return false; } } } }) }); </script> Now to issue I'm having is the form is updating like it should be but the confirmation box is not appearing. Its just going straight through.
-
ar. no tell a lie. Mail error popped up this time.
-
the browser is just sending you to the confirmation page even with the extra code.
-
yeah literary no errors. No server errors. Just nothing and still no emails being sent.
-
Hi. I am making an IT support ticketing system were a user raises a job. They receive a thank you email and it then sends all the engineers a copy of the job. The sending the user a thank you email works fine. its the sending to the engineers that seems to not work. the worst part is it worked last week. Ive just come back to it now and it seems to just not send the email. It does however do the redirect at the end of the code. //the code missing just adds the task to the database $rAddProblem = mysql_query($qAddProblem); $redirect = 'Location: reported.php?id='.mysql_insert_id(); $to = $_POST['email']; $subject = "Support Task Raised"; $content = "Thank you for raising your support issue, an Engineer will be allocated to the job shortly. Your task ID is ".mysql_insert_id()." and you can monitor the task at http://www.website.co.uk/tickets/ The details of the task are as follows: Description: ".$_POST['description']." Category: ".$_POST['category']." You will be informed when we have dealt with your support issue, an engineer may contact you to discuss any problems."; mail($to, $subject, $content); $admContent = "A support task has been raised by ".$name." for ".$site." The task ID is ".mysql_insert_id().", the user who raised the job will be informed when their support issue has been dealt with. Description: ".$description; mail('[email protected]', $subject, $admContent); header ($redirect); } } Any ideas? thanks Danny
-
Hi Guys I am now heading to a section in my website were is will be using dates. I'll be comparing, adding and subtracting dates from each other. I am just wondering if anybody know of any decent tutorials out there to best describe how to store dates in a database which will best suit this purpose. At the moment I am storing them in the English format of dd/mm/yyyy. I have read a few articles but lots of people have different ideas on how this is done. Im looking for the more professional approach. Thanks
-
Well another issue with IE 9 and its rendering. This is a strange one though. Ok I have a div that IE9 ONLY is ignoring the css for. Here is the code <div id="step1"> <h1>Step 1</h1> <img src="/images/call--back-now.png" width="65" height="90" align="left" class="man"> <br><p>One of our friendly claims advisers will give you a quick call and asses your eligibility to claim. </p> </div> CSS #step1 { color: rgb(204,204,204); float: left; width: 380px; margin-left: 20px; padding: 20px; margin-bottom: 20px; height: 140px; background-image: url('/images/backgrounds/steps.jpg'); } Now heres the funny thing. On another div I have similar styling. The only difference being this next one works! <div id="startClaim"> <h3 class="StartClaim">Start Your Claim Here! </h3> <div id="startImg"> <img src="/images/backgrounds/contactHere.png" width="159" height="220"> </div> <div id="StartPara"> <p class="StartText">Falcon & Pointer <br>make claiming back your PPI nice and easy. Just <a href="/start-claim.php">click here</a>, fill out the simple form and leave the rest to us. </p> </div> </div> CsS #startClaim { float: left; height: 330px; width: 500px; background-image: url(/images/backgrounds/check-list.png); background-repeat: no-repeat; padding: 10px; background-position: 300px 10px; margin-bottom: 20px; } I've tried everything to replicate this div like the other one or vice versa but I cant. Any help would be much appreciated as I have exhausted all other possibilities myself and I don't know where else to turn. thank you
-
yes the query works fine as i am displaying other information from the same query. With the current code however if I click update it insert into county.... ""
-
oh and the $i was removed. sorry
-
correction code change but still not working $qGetCounty = "SELECT * FROM Counties ORDER BY FIELD(country,'England','Wales','Scotland'), county "; $rGetCounty = mysql_query($qGetCounty); echo "<select name=\"county\">"; $PrevCountry = ""; while ($county = mysql_fetch_assoc($rGetCounty)) { if ($county['country'] != $PrevCountry) { $PrevCountry = $county['country']; echo "<optgroup label='$PrevCountry'>"; } $selected = ($row_ClubDetails['county']) ? ' selected="selected"' : ''; echo " <option value= '\"$i\"$selected'>{$county['county']}</option>"; } echo "</select>" ;