Jump to content

spyke01

Members
  • Posts

    74
  • Joined

  • Last visited

    Never

Everything posted by spyke01

  1. if a div wont take a focus, how can i move down the page to a section without using an "a name" tag?
  2. from what i saw on google you can do setfocus(document.item) instead of document.item.focus() i tried both ways however to no avail
  3. i have a div that i need to focus the page on so that the user can see their new comment flashing. I am using scriptaculous from script.aculo.us The div: [CODE] <div id="11" class="comment" onload="setforcus(document.11); new Effect.Highlight(this); new Effect.Highlight(this);"> <a href="http://www.fasttracksites.com">paden</a><br /> <small>Posted on Sep 20, 2006</small><br /><br /> asdasd </div> [/CODE] heres the full page: [url=http://www.fasttracksites.com/demos/blog/index.php?p=viewentry&id=1]http://www.fasttracksites.com/demos/blog/index.php?p=viewentry&id=1[/url] the page just stays at the top, any ideas?
  4. that would still be one image, the large one, i need to actually create the smaller ones for a shorter load time
  5. I need to create 2 different sized thumbnails automaticly from an image being uploaded, the databas insertion works fine, but after the first image is uploaded, the other two never get made. I only get a dialog box saying that the script on the page is taking too long to execute and asks if i want to stop it or continue. I added echo statements in but the script wont print past some basic html for the menus page: [code] <?php include "includes/header.php"; //===================================================== // If the user is not logged in redirect them //===================================================== if (!isset($_SESSION[user_level])) { // User is not allowed in the admin section, kick them out echo "\n You do not have sufficient access rights to access this section, or you are not logged in. You are being redirected to the login page.<br />"; echo "\n If you are not redirected automaticly, please click <a href=\"$menuvar[LOGIN]\">here</a>.<br />"; echo "\n <meta http-equiv='refresh' content='1;url=$menuvar[LOGIN]'>"; } //===================================================== // If the user is an employee the print the page //===================================================== else { if ($_SESSION[user_level] != ADMIN && $_SESSION[user_level] != EDITORS && $_SESSION[user_level] != STREET_TEAM) { echo "\n You do not have sufficient access rights, please contact an administrator."; } else { //======================================================== // Upload the photo //======================================================== if(isset($_POST[submit])){ $typeOfFile = $_FILES['large_pic']['type']; $fileName = $_FILES['large_pic']['name']; $fileExt = strtolower(substr($fileName,strrpos($fileName,"."))); $fileName = str_replace("\\","",$fileName); $fileName = str_replace("'","",$fileName); $randName = md5(rand() * time()); // make a random filename $largefilename = "../assets/galleries2/maroonweeklystreetteam/" . $randName . $fileExt; // Upload the full sixed image move_uploaded_file($_FILES['large_pic']['tmp_name'], "../assets/galleries2/maroonweeklystreetteam/" . $randName . $fileExt); // Get the image size so we can calculate the new size list($width, $height) = getimagesize("../assets/galleries2/maroonweeklystreetteam/" . $randName . $fileExt); if ($width < $height) { // Get what the next ID will be - not pretty but i dont feel like fixing it $sql = "SELECT ID FROM galleryimages ORDER BY ID DESC LIMIT 1"; $result = mysql_query($sql) or die(mysql_error()); if ($row = mysql_fetch_array($result)) { $last_id = $row['ID'] + 1; } mysql_free_result($result); // Insert the caption and image into the DB $sql = "INSERT INTO `galleryimages` (ID, filename, memberof, caption, numinorder, height, width, owner) VALUES('$last_id', 'assets/galleries2/maroonweeklystreetteam/". $randName . $fileExt . "', '0', '$_POST[caption]', '$last_id', '0', '540', '0')"; $result = mysql_query($sql) or die(mysql_error()); // Our files $mediumfilename = "assets/galleries2/maroonweeklystreetteam/" . $randName . "_mid." . $fileExt; $smallfilename = "assets/galleries2/maroonweeklystreetteam/" . $randName . "_thumb." . $fileExt; // Create the Medium sized pic - Height is more important than width to us $tosubtract = $height - 380; // This tells what to subtract the current hieght and width by to get 380 $newwidth = $width - $tosubtract; $newheight = $tosubtract; createthumb($largefilename, $mediumfilename, $width, $height, $newwidth, $newheight); // Create the Thumbnail - Height is more important than width to us $tosubtract = $height - 159; // This tells what to subtract the current hieght and width by to get 159 $newwidth = $width - $tosubtract; $newheight = $tosubtract; createthumb($largefilename, $smallfilename, $width, $height, $newwidth, $newheight); } else { echo "\n <center>"; echo "\n The height of your image should be larger than the width. Please crop the image and try again"; echo "\n </center>"; echo "\n <br />"; echo "\n <br />"; } unset($_POST[submit]); } //======================================================== // Print our form //======================================================== echo "\n <center>"; echo "\n <form method=\"POST\" action=\"$menuvar[STREETTEAM]\" enctype=\"multipart/form-data\">"; echo "\n <table class='TableBorder' border='0' cellpadding='0' cellspacing='1' style=\"width: 400px;\">"; echo "\n <tr>"; echo "\n <td colspan=\"2\" class=\"title1\">Add Street Team Photo</td>"; echo "\n </tr>"; echo "\n <tr>"; echo "\n <td colspan=\"2\" class=\"title2\">Please only upload JPG images with a height larger than their width.</td>"; echo "\n </tr>"; echo "\n <tr>"; echo "\n <td class=\"row2\">Caption</td><td class=\"row1\"><input name=\"caption\" type=\"text\" size=\"30\" /></td>"; echo "\n </tr>"; echo "\n <tr>"; echo "\n <td class=\"row2\">Picture</td><td class=\"row1\"><input type=\"file\" name=\"large_pic\" /></td>"; echo "\n </tr>"; echo "\n </table>"; echo "\n <br />"; echo "\n <input type=\"submit\" name=\"submit\" class=\"button\" value=\"Add It!\" />"; echo "\n </form>"; echo "\n </center>"; } } include "includes/footer.php"; ?> [/code] function: [code] //============================================ // This function is designed to create a // thumbnail from the given image. // // ORIGINALLY FROM: // http://icant.co.uk/articles/phpthumbnails/ // Modified for use here // // USAGE: // createthumb($p, "tn_".$p, 150, 150); // // OPTIONS: // $name Original filename // $filename Filename of the resized image // $new_w width of resized image // $new_h height of resized image //============================================ function createthumb($name, $filename, $old_w, $old_h, $new_w, $new_h) { echo "$name, $filename, $old_w, $old_h, $new_w, $new_h<br />"; $system=explode(".",$name); print_r($system); if (preg_match("/jpg|jpeg/", $system[3])){$src_img = imagecreatefromjpeg($name);} if (preg_match("/png/", $system[3])){$src_img = imagecreatefrompng($name);} $dst_img = ImageCreateTrueColor($new_w, $new_h); if (imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $new_w, $new_h, $old_x, $old_y)) { echo "made copyresampled<br />"; } else { echo "didnt make copyresampled<br />"; } if (preg_match("/png/", $system[3])) { imagepng($dst_img, "../" . $filename); } else { imagejpeg($dst_img, "../" . $filename); } imagedestroy($dst_img); imagedestroy($src_img); } [/code]
  6. I need to create 2 different sized thumbnails automaticly from an image being uploaded, the databas insertion works fine, as well as the first image, however the second and third images look like this: [img]http://www.maroonweekly.com/assets/galleries2/maroonweeklystreetteam/1570932f817abf417fa50d20370b650b_mid..jpg[/img] [img]http://www.maroonweekly.com/assets/galleries2/maroonweeklystreetteam/1570932f817abf417fa50d20370b650b_thumb..jpg[/img] Heres the code thats called when an image is uploaded [code] if(isset($_POST[submit])){                                 $typeOfFile = $_FILES['large_pic']['type'];                 $fileName = $_FILES['large_pic']['name'];                 $fileExt = strtolower(substr($fileName,strrpos($fileName,".")));                 $fileName = str_replace("\\","",$fileName);                 $fileName = str_replace("'","",$fileName);                 $randName = md5(rand() * time()); // make a random filename                                 $largefilename = "../assets/galleries2/maroonweeklystreetteam/" . $randName . $fileExt;                                                                // Upload the full sixed image                 move_uploaded_file($_FILES['large_pic']['tmp_name'], "../assets/galleries2/maroonweeklystreetteam/" . $randName . $fileExt);                                                 // Get the image size so we can calculate the new size                 list($width, $height) = getimagesize("../assets/galleries2/maroonweeklystreetteam/" . $randName . $fileExt);                                 if ($width < $height) {                     // Get what the next ID will be - not pretty but i dont feel like fixing it                                    $sql = "SELECT ID FROM galleryimages ORDER BY ID DESC LIMIT 1";                     $result = mysql_query($sql) or die(mysql_error());                                         while ($row = mysql_fetch_array($result)) {                         $last_id = $row['ID'] + 1;                     }                                         // Insert the caption and image into the DB                     $sql = "INSERT INTO `galleryimages` (ID, filename, memberof, caption, numinorder, height, width, owner) VALUES('$last_id', 'assets/galleries2/maroonweeklystreetteam/". $randName . $fileExt . "', '0', '$_POST[caption]', '$last_id', '0', '540', '0')";                     $result = mysql_query($sql) or die(mysql_error());                                                                                // Our files                     $mediumfilename = "assets/galleries2/maroonweeklystreetteam/" . $randName . "_mid." . $fileExt;                     $smallfilename = "assets/galleries2/maroonweeklystreetteam/" . $randName . "_thumb." . $fileExt;                                                     // Create the Medium sized pic - Height is more important than width to us                     $tosubtract = $height - 380; // This tells what to subtract the current hieght and width by to get 380                     $newwidth = $width - $tosubtract;                     $newheight = $height - $tosubtract;                                         createthumb($largefilename, $mediumfilename, $newwidth, $newheight);                                         // Create the Thumbnail - Height is more important than width to us                     $tosubtract = $height - 159; // This tells what to subtract the current hieght and width by to get 159                     $newwidth = $width - $tosubtract;                     $newheight = $height - $tosubtract;                                         createthumb($largefilename, $smallfilename, $newwidth, $newheight);                                }                 else {                        echo "\n            <center>";                     echo "\n                The height of your image should be larger than the width. Please crop the image and try again";                     echo "\n            </center>";                     echo "\n            <br />";                     echo "\n            <br />";                 }                 unset($_POST[submit]);             }  [/code] and heres the create thum function [code] //============================================ // This function is designed to create a // thumbnail from the given image. // // ORIGINALLY FROM: // http://icant.co.uk/articles/phpthumbnails/ // Modified for use here // // USAGE: // createthumb($p, "tn_".$p, 150, 150); // // OPTIONS: // $name        Original filename // $filename    Filename of the resized image // $new_w        width of resized image // $new_h        height of resized image //============================================ function createthumb($name, $filename, $new_w, $new_h) {     $system=explode(".",$name);         if (preg_match("/jpg|jpeg/", $system[1])){$src_img = imagecreatefromjpeg($name);}     if (preg_match("/png/", $system[1])){$src_img = imagecreatefrompng($name);}         list($old_x, $old_y) = getimagesize($name);         if ($old_x > $old_y) {         $thumb_w = $new_w;         $thumb_h = $old_y * ($new_h/$old_x);     }         if ($old_x < $old_y) {         $thumb_w = $old_x * ($new_w/$old_y);         $thumb_h = $new_h;     }         if ($old_x == $old_y) {         $thumb_w = $new_w;         $thumb_h = $new_h;     }         $thumb_w = number_format($thumb_w, 0, '.', '');     $thumb_h = number_format($thumb_h, 0, '.', '');             $dst_img = ImageCreateTrueColor($thumb_w, $thumb_h);         echo $dst_img . " " . $src_img . " " . 0 . " " . 0 . " " . 0 . " " . 0 . " " . $thumb_w . " " . $thumb_h . " " . $old_x . " " . $old_y;         imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $thumb_w, $thumb_h, $old_x, $old_y);         if (preg_match("/png/", $system[1])) {         imagepng($dst_img, "../" . $filename);     }         else {         imagejpeg($dst_img, "../" . $filename);     }         imagedestroy($dst_img);     imagedestroy($src_img); }  [/code]
  7. Ok thought this was fixed, but the gremlins have fought back once again. Im still having the hated double scroll bar problems, and sometimes text will slip beneath my footers Page(for double scroll bar and footer issue): [url=http://www.fasttracksites.com/sitemap.php]http://www.fasttracksites.com/sitemap.php[/url] CSS: [url=http://www.fasttracksites.com/stylesheets/main.css]http://www.fasttracksites.com/stylesheets/main.css[/url] NOTE: you may have to scroll to the right to see the double scrollbar
  8. Ok, i have [URL=http://"http://www.fasttracksites.com/ftsssforum.php"]this page[/URL] and at the bottom, you can see "Free Version: Download" well the F on free is under the blue "border" the border is really the background image of #page. There is a list on the page like so [CODE] <ul class="smaller"> <li>Fast Track Sites is not resposible for what you do with this application.</li> <li>Fast Track Sites is not resposible for any damage caused this application.</li> <li>This application is As-Is with no warranty(except for the professional edition).</li> <li>Support for this application may found on our forums.</li> </ul> [/CODE] the funny thing is that when i increase the padding left like so: [CODE] ul.smaller { font-family: Helvetica, Tahoma, Verdana, Arial, sans-serif; font-size: 12px; line-height: 14px; padding-left: 10px; } [/CODE] it moves the Free Version text to the left i want the Free Version text to be where its at, but not get sucked under the "blue border of doom", FF and opera are playing nice with the lists and text just not IE
  9. Ok, i fired up Opera 9 last night and lo and behold my page looks like crap, firefox does things great, ie is ok, but opera really kills the page. Heres the page: http://www.fasttracksites.com/privacypolicy.php Heres the problems: 1. Opera doesnt make the fage 100% height 2. Text slides underneath right hand footer(sometimes happens in IE and FF)
  10. ok, the problem is that the width of container has to be 100%, i ending up wrapping the contents of container with a wrapper called page and used the following css to make sure the page didnt change width or the float drop [code] div#container { position: relative; width: 100%; min-height: 100%; /* For Modern Browsers */ height: auto !important; /*For Modern Browsers */ height: 100%; /*For IE */ margin: 0px; padding: 0px; text-align: left; } div#page { width: 1011px; min-height: 100%; /* For Modern Browsers */ height: auto !important; /*For Modern Browsers */ height: 100%; /*For IE */ margin: 0px; padding: 0px; text-align: left; } [/code] thanks anyways guys
  11. Im working on a new layout, and having several problems, ive finally got my two different footers acting like i want them, but now i have double scroll bars, the other problem is that the two columns need to stretch as one(if the left column stretches to 150px then the right column needs to stretch to be 150px) Heres the page: http://www.fasttracksites.com/new%20layout/ Can anyone help me fix these two problems?
  12. Ok guys heres the page [url=http://www.fasttracksites.com/new layout]http://www.fasttracksites.com/new layout[/url] The problem im having is that the content on the right side is being stretched by content(like its supposed to) however the footer is not moving down the page like it should, its stuck there. I know that its stuck due to position: absolute; but i can't remove it, because if the content is not big enough, then the footer wont be lined up with the bottom of the viewport. Any ideas?
  13. the little box is the newline character, sometimes notepad freadks out on it, if you copy and paste it into say wordpad it will change it to a new line, try these two fwrite($fo, $towrite . "/n"); fwrite($fo, $towrite . "/r"); im suprised php isnt throwing errors the way your doing your variables, if you are doing anything wih multiple variables(echo, print, functions, etc) then the . is your friend. it appends one variable onto the end of the other
  14. what you want to do is this [code] WriteTo('testing.txt', $user . $bio); [/code]
  15. i think you can add \n or \r to the end of the $toWrite variable, i forget which one you should use
  16. spyke01

    alt=""

    actually you do this [code] <a href="#" title="blah blah blah">Link text</a> [/code]
  17. you can also do this [code] $sql = "SELECT * FROM `users` WHERE users_username='$requestedUsername'"; $result = mysql_query($sql); if (mysql_num_rows($result) == 0) {     // username is not in the databse so continue creating the account } else {     // username exists so tell the user so they can choose another one } [/code]
  18. ok im trying to be able to move forums, or other items for that matter, with simple PHP functions. The order of items is of course stored in the orders field of a table, the lower the value, the closer to the top of the list it is. I am using this function to do it, but sometimes it freaks out, usualy in IE(wierd though it is), and wont do anything, usually when this happens, the order is set to 999 and stays there. the code: [code] if ($_GET[action] == "moveforum") { $sql = "SELECT forum_order FROM `forums` WHERE forum_id='$_GET[id]' LIMIT 1"; $result = mysql_query($sql); if ($row = mysql_fetch_array($result)) { $current_order_num = $row[forum_order]; } mysql_free_result($result); if ($_GET[dir] == "up") { $target_order_num = ($current_order_num > 1) ? $current_order_num - 1 : 1; } else { $target_order_num = $current_order_num + 1; } $sql = "UPDATE `forums` SET forum_order='999' WHERE forum_id='$_GET[id]'"; $result = mysql_query($sql); $sql = "UPDATE `forums` SET forum_order='$current_order_num' WHERE (forum_order='$target_order_num' AND forum_cat_id='$_GET[catid]')"; $result = mysql_query($sql); $sql = "UPDATE `forums` SET forum_order='$target_order_num' WHERE forum_id='$_GET[id]'"; $result = mysql_query($sql); } [/code] the style of link that activates it index.php?action=moveforum&id=$forum_id&catid=$forum_cat_id&dir=down Does anyone see any problems with the code, or a simpler way of doing things?
  19. Ok, ive got the footer bar that should be at the bottom of content, in FF it displays perfect, but in IE it disappers http://fasttracksites.com/new%20layout/ heres the css [code] html, body {height: 100%;} body { background: #beb185 url('images/bggrad.gif'); background-attachment: fixed; font-family: Helvetica, Tahoma, Verdana, Arial, sans-serif; font-size: 12px; line-height: 16px; color: #000; padding: 0px; margin: 0px; text-align: left; } /*============================== Layout ==============================*/ div#container { background: #fff; width: 961px; height: 100%; margin: 0px; padding: 0px; text-align: left; float: left; z-index: 1; } div#page { height: 100%; float: left; z-index: 2; } #left-col { background: #121212 url('images/leftcolgrad.jpg'); color: #fff; width: 190px; min-height: 100%; height: 100%; padding: 0px 5px 0px 5px; border-right: 10px solid #13496e; float: left; z-index: 3; } #right-col { color: #000; width: 750px; height: 100%; padding: 0px; border-right: 1px solid #121212; float: right; z-index: 4; } div#header { background: #fff; width: 740px; height: 78px; margin: 0px; padding: 0px 5px; text-align: left; float: left; z-index: 5; } div#content { background: #fff; width: 740px; padding: 0px 5px 0px 5px; float: left; clear: both; z-index: 6; } div#footer { position: absolute; bottom: 0px; background: #000 url('images/footergrad.jpg'); width: 740px; height: 180px; padding: 0px 5px 0px 5px; float: left; /*clear: both;*/ z-index: 7; } [/code]
  20. spyke01

    ems vs pxs

    i am redesigning my current site with more css and JS, and wanted to see what the big difference is between ems and pxs. is there a way to make  1em=1px? the reason i ask is because i like the control i have with pxs, if i cant make them the same, or its not a good idea, then can someone help me with this: Ok we have this box: +----+----------+ |      |              | |      |              | |      |              | +----+----------+ It is 900px wide, the left column is 200px and the right 700px, we want 2px padding all the way around, so our css is like this: [code] #box {     width: 900px;     padding: 0px;     margin: 0px; } #left-col {     width: 196px;     padding: 2px; } #right-col {     width: 696px;     padding: 2px; } [/code] how does this relate in terms to ems if our default text is this: [code] body { font-family: Helvetica, Tahoma, Verdana, Arial, sans-serif; font-size: 12px; } [/code]
  21. Ok there will probally be much flaming about this, but here goes. ive seen many people using classes, but ive never used them simply because i dont see a reason to do it in my code. I have seen where people use it to access different style databses, kinda like phpbb does. ive programmed forums, content management systems, trouble ticket systems, and store systems but never once used a class. So heres my question, when(please use a real world example) would i really need to use them? how much more effecient is if to use a class instead of functions with global variables?
  22. yep always remember that, if your in a function use global
  23. this is one of the problem [code] $filename=rand(500,2000).$_FILES['file']['name']; $small_image=rand(500,2000).$_FILES['file']['name']; [/code] should be [code] $filename=rand(500,2000).$_FILES['file']['name']; $small_image=rand(500,2000).$_FILES['small_image']['name']; [/code] because of the name on the input field
×
×
  • 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.