Jump to content

Woodburn2006

Members
  • Posts

    214
  • Joined

  • Last visited

    Never

Everything posted by Woodburn2006

  1. ok cool thanks, well i have just brought a book on ajax and javascript which covers with using it alongside php etc and covers dom so will give that a read and see what i get out of it
  2. ok sounds good but im new to all of this, i can do php sql html etc but javascript is a new one for me. do you know of any tutorials i can look at to do this as i like to learn it and simply not copy code and not understand it, thanks
  3. i have tried doing the page the way you have shown using javascript but i cannot get it to work. should this code do the trick? <script type='text/javascript'> function show(x) { if (x = 'Guitars') { document.getElementById("gear_inner").innerHTML = "the html content you want to show for guitars"; } else if (x = 'Effects') { document.getElementById("gear_inner").innerHTML = "the html content you want to show for effects"; } //and so on... } </script> <? $member = ((isset($_GET['member']))?($_GET['member'])'')); if($member!=""){ $query_member = "SELECT role FROM site_gear WHERE member = '$member' LIMIT 1"; $result_member = mysql_query($query_member, $connection); $row_member = mysql_fetch_array($result_member); extract($row_member); $div = "content_gear_".$member; $query_menu = "SELECT id,heading FROM site_gear WHERE member = '$member'"; $result_menu = mysql_query($query_menu, $connection); $div = "content_gear_".$member; echo"<div id='$div'><div id='gear_1'> <h1>$member - $role</h1> <hr width='100%' color='#4885c6' />"; echo"<form id='form1' method='post' action='?go=gear&member=$member'> <select id= 'gear_select' onchange='show(this.value)'>"; while ($row_menu = mysql_fetch_array($result_menu)) { extract($row_menu); echo"<option value='$id'>$heading</option>"; } echo"</select> </form> <div id='gear_inner'> <ul>"; if ($_SERVER['REQUEST_METHOD'] == "POST") { $id = $_POST["gear_menu"]; $query_gear = "SELECT heading,content FROM site_gear WHERE id = '$id'"; }else{ $query_gear = "SELECT heading,content FROM site_gear WHERE member = '$member' LIMIT 1"; } $result_gear = mysql_query($query_gear, $connection); $row_gear = mysql_fetch_array($result_gear); extract($row_gear); echo $content; echo"</ul></div></div></div>"; }else{ echo" <div id='content_gear'> <div id='gear_heading'> Band Gear<hr width='100%' color='#4885c6' /> </div> <div id='gear'> <br /> <a href='index2.php?go=construction'>Andy Teague - Bass/Vocals</a><br /><br /> <a href='index2.php?go=construction'>Ben Smith - Guitar/Vocals</a><br /><br /> <a href='index2.php?go=construction'>Lee Munkton - Drums</a><br /> </div> </div> "; } ?>
  4. also, how would i do the above if the info is being pulled from a DB?
  5. how do you do mod re-writes then? im just acting upon what the guy has asked me to do, i will be contructing a site map when the site is complete to get rating
  6. similar to nl2br() is there any way of going through a block of text and making it make the inverted commas visible, as i have this text taken from a DB and it has a load of question marks where there should be an inverted comma. also, is there a way to make a new line create a bullet point similar to how nl2br() creates a break? this is the page im working on: http://www.ontherocks.me.uk/index2.php?go=gear&member=ben thanks
  7. i am creating a site for a local band and am very new to ajax. what i was wondering is would it be easy to create the following page using ajax? so that when you click 'view gear' it just changes the bit below the select box and not the whole page. if so are there any good tutorials out there that are similar to what i want to do? http://www.ontherocks.me.uk/index2.php?go=gear&member=ben thanks
  8. im new to verification in php so i was wondering how you would vaerify that a date intered in a form is in the form of 'YYY-MM-DD' ? thanks
  9. legendary, cheers mate works a treat
  10. ok i have doen some testing, it works fine until i have a full page of landscape images. so if the last page of landscape is full then it will not load any portrait photos. but if there is space for more landscape then it will load portrait images onto next page. and i can assure that there are portrait images on the server check this link for example: http://www.ontherocks.me.uk/index2.php?go=media
  11. superb, thanks alot, works a treat at the mo, will test it ptoperly tomo when i get time
  12. i get this error: Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-9, 9' at line 1 ive had a look but cant seem to see the problem
  13. i have images in a database and a column in the table is 'orientation'. what i want to do is for the query to get all of the images that are 'l' (landscape) first then get all of the images which are 'p' (portrait) but what i want to do is display them on seperate pages in the images gallery. if you take a look at: http://www.ontherocks.me.uk/index2.php?go=media you will see that the landscape images are directly followed by the portrait images. if i can i would like the portrait images to start on the next page. the page code is: <div id="content_home"> <div id="images_thumbs"> <? $page = $_GET['page'] ? (int) $_GET['page'] : 1; $limit= 9; $query_count = "SELECT count(*) AS rowcount FROM site_images"; $result_count = mysql_query($query_count, $connection); $row_count = mysql_fetch_array($result_count, MYSQL_ASSOC); $totalrows = $row_count['rowcount']; $limitvalue = $page * $limit - ($limit); $query_thumbs = "SELECT * FROM site_images ORDER BY id LIMIT $limitvalue, $limit"; $result_thumbs = mysql_query($query_thumbs) or die("Error: " . mysql_error()); echo"<table width='336' border='0' cellspacing='5' cellpadding='0'> <tr> "; $img_number=0; while ($row_thumbs = mysql_fetch_array($result_thumbs)) { extract($row_thumbs); if($img_number == 3 OR $img_number ==6){ echo " </tr> <tr> <td width='112' valign='middle' align='center'> <A href='$lrg' rel='lightbox[live]' title=''><img id='$id' src='$thumb' height='75px' border='1'></a> </td>"; }else{ echo " <td width='112' valign='middle' align='center'> <A href='$lrg' rel='lightbox[live]' title=''><img id='$id' src='$thumb' height='75px' border='1'></a> </td>"; } $img_number++; } $numofpages = ceil($totalrows / $limit); echo"</td> </tr> <tr> <td colspan='3' class='photos_thumbs' align='center'>"; if($page > 1){ $pageprev = $page - 1; echo" <a href=\"$PHP_SELF?go=media&page=".$pageprev."\"><< Previous Page</a> "; } if($page < $numofpages AND $page > 1){ echo" :: "; } if($page < $numofpages){ $pagenext = $page + 1; echo" <a href=\"$PHP_SELF?go=media&page=".$pagenext."\">Next Page >></a> "; } echo"</td></tr></table>"; ?> </div> </div> is there a way i can do this? thanks
  14. now i ge tthis: Fatal error: Allowed memory size of 25165824 bytes exhausted (tried to allocate 15552 bytes) in /customers/ontherocks.me.uk/ontherocks.me.uk/httpd.www/cp/functions.php on line 19 starting to get a bit irritating now. no matter what memory limit im entering it comes up with the same error msg and same bytes
  15. i have this code at the beginning of the script: ini_set ("display_errors", "1"); error_reporting(E_ALL); set_time_limit(0); and these are the errors i get Warning: set_time_limit() [function.set-time-limit]: Cannot set time limit in safe mode in /customers/ontherocks.me.uk/ontherocks.me.uk/httpd.www/cp/images/add.php on line 5 Fatal error: Allowed memory size of 25165824 bytes exhausted (tried to allocate 15552 bytes) in /customers/ontherocks.me.uk/ontherocks.me.uk/httpd.www/cp/functions.php on line 19 looking like a combination. anything i can do about this?
  16. it still seems to crash part way through, if i down size the images manually then it works but if i try to put a photo that is staright from the camera unedited then it crashes for some strange reason
  17. is there anyway of changing this function so that it creates greyscale thumbnails rather than coloured images? <? $db_path = "/customers/ontherocks.me.uk/ontherocks.me.uk/httpd.www/cp/db.inc"; function connect_to_sql($host,$usr,$pwd,$db) { $connection = mysql_connect($host,$usr,$pwd); mysql_select_db($db); if (mysql_error()) { print "Database ERROR: " . mysql_error(); } return $connection; } ################################################################################ function createthumb($name,$filename,$new_w,$new_h) { $system=explode('.',$name); // split filename either side of the '.' if (preg_match('/jpg|jpeg|JPG/',$system[1])){ // if extension is jpg or jpeg $src_img=imagecreatefromjpeg($name); // create a copy of the image in jpg } if (preg_match('/png/',$system[1])){ // if extension is png $src_img=imagecreatefrompng($name); // create a copy of the image in png } $old_x=imageSX($src_img); // gets width of original image $old_y=imageSY($src_img); // gets height of original image if ($old_x > $old_y) { // if img is wider than high $thumb_w=$new_w; // sets width variable of new img $thumb_h=$old_y*($new_h/$old_x); // sets height variable by doing: height = original width * (100 / original height) } if ($old_x < $old_y) { // other way around from setting wider than high $thumb_w=$old_x*($new_w/$old_y); $thumb_h=$new_h; } if ($old_x == $old_y) { // if img is square sets variabls straight forwardly $thumb_w=$new_w; $thumb_h=$new_h; } $dst_img=ImageCreateTrueColor($thumb_w,$thumb_h); // creates image imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y); // copies into new image if (preg_match("/png/",$system[1])) // if old file extension is png { imagepng($dst_img,$filename); // extension of new image is png } else { imagejpeg($dst_img,$filename); // else extension of new image is jpeg or jpg } imagedestroy($dst_img); //destroys variable imagedestroy($src_img); } ?>
  18. my max upload is 12mb so that isnt a problem, would it be the max_execution_time as that is set to 30 seconds? if so how would i change it go last longer or even infinately?
  19. how do i look up my php config file?
  20. i am creating a script to upload images to the server. the script works fine with smaller images but when i try to upload a large sized image it does not work. function createthumb($name,$filename,$new_w,$new_h) { $system=explode('.',$name); // split filename either side of the '.' if (preg_match('/jpg|jpeg/',$system[1])){ // if extension is jpg or jpeg $src_img=imagecreatefromjpeg($name); // create a copy of the image in jpg } if (preg_match('/png/',$system[1])){ // if extension is png $src_img=imagecreatefrompng($name); // create a copy of the image in png } $old_x=imageSX($src_img); // gets width of original image $old_y=imageSY($src_img); // gets height of original image if ($old_x > $old_y) { // if img is wider than high $thumb_w=$new_w; // sets width variable of new img $thumb_h=$old_y*($new_h/$old_x); // sets height variable by doing: height = original width * (100 / original height) } if ($old_x < $old_y) { // other way around from setting wider than high $thumb_w=$old_x*($new_w/$old_y); $thumb_h=$new_h; } if ($old_x == $old_y) { // if img is square sets variabls straight forwardly $thumb_w=$new_w; $thumb_h=$new_h; } $dst_img=ImageCreateTrueColor($thumb_w,$thumb_h); // creates image imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y); // copies into new image if (preg_match("/png/",$system[1])) // if old file extension is png { imagepng($dst_img,$filename); // extension of new image is png } else { imagejpeg($dst_img,$filename); // else extension of new image is jpeg or jpg } imagedestroy($dst_img); //destroys variable imagedestroy($src_img); } any ideas why this may be happening. to see the results got to http://www.ontherocks.me.uk/cp user: lee pass: ontherocks
  21. i have a script that creates thumbnails from an uploaded img. this script works when i have the script on a page in a folder and the imgs being created in subfolders within the root folder that the php file is stored. the problem i am having is that when i want to create the images and put them into a different folder on a lower level of the site map it just creates black images. for example: the structure of my site map is; ROOT FOLDER - img -- gallery --- lrg (where the lrg version of the img is) --- temp (where the temporary img is uploaded) --- thumbs (where the thumb will be saved) - content - cp -- images (where add.php is) what i want to do is have the function beingcalled in add.php and for the files to be stored in the lrg and thumbs folders within the img folder. i have tried using paths etc to do this but it still does not work. here is the function: function createthumb($name,$filename,$new_w,$new_h) { $system=explode('.',$name); // split filename either side of the '.' if (preg_match('/jpg|jpeg/',$system[1])){ // if extension is jpg or jpeg $src_img=imagecreatefromjpeg($name); // create a copy of the image in jpg } if (preg_match('/png/',$system[1])){ // if extension is png $src_img=imagecreatefrompng($name); // create a copy of the image in png } $old_x=imageSX($src_img); // gets width of original image $old_y=imageSY($src_img); // gets height of original image if ($old_x > $old_y) { // if img is wider than high $thumb_w=$new_w; // sets width variable of new img $thumb_h=$old_y*($new_h/$old_x); // sets height variable by doing: height = original width * (100 / original height) } if ($old_x < $old_y) { // other way around from setting wider than high $thumb_w=$old_x*($new_w/$old_y); $thumb_h=$new_h; } if ($old_x == $old_y) { // if img is square sets variabls straight forwardly $thumb_w=$new_w; $thumb_h=$new_h; } $dst_img=ImageCreateTrueColor($thumb_w,$thumb_h); // creates image imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y); // copies into new image if (preg_match("/png/",$system[1])) // if old file extension is png { imagepng($dst_img,$filename); // extension of new image is png } else { imagejpeg($dst_img,$filename); // else extension of new image is jpeg or jpg } imagedestroy($dst_img); //destroys variable imagedestroy($src_img); } here is add.php: <? $function = ((isset($_GET['function']))?($_GET['function'])'')); if($function=="add"){ if ($_FILES['uploadedfile']['name'] !=""){ $pic1=$_FILES['uploadedfile']['name']; $target_path = "/customers/ontherocks.me.uk/ontherocks.me.uk/httpd.www/img/gallery/temp/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { $nm = '1'; $new_img = "http://www.ontherocks.me.uk/img/gallery/temp/$pic1"; $thumb = "/customers/ontherocks.me.uk/ontherocks.me.uk/httpd.www/img/gallery/thumbs/$pic1"; createthumb($new_img,$thumb,100,100); }else{ echo "There was an error uploading the file, please try again!"; } }else{ $nm = '0'; echo "No New Picture Added!<br><br>"; } if ($nm=='1'){ //if ($_SERVER['REQUEST_METHOD'] == "POST"){ // $sql = " INSERT INTO gallery "; //$sql .= " (name, price, status, width, height, description, img) VALUES "; //$sql .= " ('$name', '$price', '$status', '$width', '$height', '$description', '$img') "; //$result = mysql_query($sql, $connection); //if (mysql_error()) { print "Database ERROR: " . mysql_error(); } echo " The File Has Been Added! "; } }else{ echo" <div id='news_add'> <form id='news_new' method='post' action='/cp/index2.php?go=img_add&function=add' enctype='multipart/form-data'> <br /><strong>Add Image</strong><br /><br /> <input name='uploadedfile' type='file' size='80%'> <label> <input type='submit' id='img_submit' value='Submit' class='submit'> </label> <br /><br /> </form> </div>"; } ?> hopefully you can see what i mean from these files. if it helps then to get to the page, goto: http://www.ontherocks.me.uk/cp user: lee pass: ontherocks thanks in advance
  22. i use this code to resize images that i upload for my website $save = 'thumbs/rocks1121.jpg'; $file = 'rocks.jpeg'; $size = 0.45; header('Content-type: image/jpeg'); list($width, $height) = getimagesize($file); $modwidth = $width * $size; $modheight = $height * $size; $tn= imagecreatetruecolor($modwidth, $modheight); $source = imagecreatefromjpeg($file); imagecopyresized($tn, $source, 0, 0, 0, 0, $modwidth, $modheight, $width, $height); imagejpeg($tn, $save, 100) ; it works well enough but it is only good if the images are of the same size and the same orientation. what i want to be able to do is have all of my thumbs the same size even if the original pic is a different size. so for example, if the img it is linking to portrait i still want the thumb to be 100x30 pixels but not a stretched version of the image. so basically i want it to take a 100x30 portion of the original and use that as the thumbnail. is there a way of doing this? thanks
  23. thanks for your suggestions but the inline editor looks good but is out of my league for now and i want to be able to understand it. i have learnt bits of ajax, i have a working example of some i have done here: http://travelling.dw20.co.uk/?go=photos but i think the main problem is that i do not understand how i can pass the form values through ajax into my php script. i have what i want working at the moment but just in php. you can see an example here: http://travelling.dw20.co.uk login as: egg pass: egg and edit a form post then you can see what i want to happen in ajax
  24. i have a blog on one of my sites, but i want to be able to edit entrys using ajax. so that the user will click a link below the entry and the entry will reload into a textbox so that it can be edited. the text can now be edited then when submit is clicked the page reloads back to normal again with the edited post. does anybody know any good tutorials or ways i can do this? i want a tutorial that explains everything so that iu can understand it and use it for other areas of the site. thanks alot
  25. ok cool thanks for the help anyway, i think the only solution is for IE to be destroyed and everyone use a decent browser
×
×
  • 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.