Jump to content


  • Posts

  • Joined

  • Last visited


About Cetanu

  • Birthday 11/28/1993

Contact Methods

  • MSN
  • Website URL

Profile Information

  • Gender
  • Location
    Where the monsters won't get me.

Cetanu's Achievements

Regular Member

Regular Member (3/5)



  1. Hi! I'm currently developing a photography portfolio for a friend. To display his images, rather than using a database and allowing it to get massive, I've decided to go ahead and stick them into a directory and then cycle through it. As it's currently set up, I open the directory and read it, use preg_split() to divide the files up according to file type, and then use a foreach() statement to display them. It works like a charm. But now I have a problem: I want to limit the amount of files that are echoed out. I've tried everything. Using this: $i = 0; foreach($images as $image){ // blahblahblah $i++ if($i > 10){ break; } } And that doesn't work. :| And I also decided to try and count() the array and stuff. Nothing worked. Furthermore, print_r() returns this: Array ( [0] => [1] => a_message.jpg [2] => ) Array ( [0] => [1] => cold_call.jpg [2] => ) Array ( [0] => [1] => ring_of_love.jpg [2] => ) Array ( [0] => thumbs ) Array ( [0] => [1] => unclear.jpg [2] => ) Isn't it supposed to return ONE array with different keys?! >.> Here is the code: $img_dir = "images/photographs/"; if(is_dir($img_dir)){ if($img_handle = opendir($img_dir)){ echo "<div id=\"index_thumbnails\"><div id=\"hidden_images\">"; while(($img = readdir($img_handle)) !== false){ if($img !== "Thumbs.db" && $img !== "." && $img !== ".."){ $images = preg_split('/([a-zA-Z0-9_-]*\.jpg$)/', $img, 0, PREG_SPLIT_DELIM_CAPTURE); if(empty($images)){ echo "<b>Sorry, there are no images to display!</b>"; } else{ foreach($images as $img_display){ if($img_display !== "" && $img_display !== "thumbs"){ $img_name = "images/photographs/{$img_display}"; $thumb_path = "images/photographs/thumbs/"; $size = getimagesize($img_name); $width = $size['0']; $height = $size['1']; $nwidth = round($width/20); $nheight = round($height/20); $img_thumb = imagecreatefromjpeg("{$img_name}"); $resized = imagecreatetruecolor($nwidth, $nheight); imagecopyresampled($resized, $img_thumb, 0, 0, 0, 0, $nwidth, $nheight, $width, $height); imagejpeg($resized, "{$thumb_path}{$img}_thumb.jpg"); echo "<img src=\"{$thumb_path}{$img}_thumb.jpg\" height=\"{$nheight}\" width=\"{$nwidth}\"/>"; } } } print_r($images); } } closedir($img_handle); echo "</div></div>"; } } Bear with the fact that I'm not using a function to shrink my images. xD I'm getting all of the work out of the way before I make a function and link it to a database to get image information. All help is appreciated! Thank you!
  2. Oh, because I wasn't matching classes, I was matching the content of the <li> to the name of a class. I.e., <li>Bio</li> matches class="bio".
  3. Okay, so. $('#head li').mouseenter(function(){ var name = $(this).html(); $('#bubble.'+name+'').show(); }); $('#head li').mouseout(function(){ $('#bubble').hide(); }); I'm trying to make the element whose class MATCHES the <li> class appear when the <li> is moused over. In that code, NAME is the variable that stores the information that matches up to the class... ...but I can't make the element appear! I know the variable is correct, so why doesn't the #bubble whose class = <li>'s information appear? Thanks.
  4. Okay, thanks...I think I got it.
  5. Could you help me along with this? I've not used JS for the column... I didn't know I could.
  6. I wanted to set the height of a <div> equal to 100% of the entire page, NOT the viewport. I want the container to extend all the way down. Basically, the page is set up in a two column format. The column on the left has a BG color and the one on the right doesn't. If the right's content goes farther than the view, the left column doesn't follow. Here is a link that I've hosted on file sharing. It isn't live or anything... http://dl.dropbox.com/u/3666815/portfolio/test.html Thanks in advance!! CSS: *{ margin:0; padding:0; } html, body{ min-height:100%; } body{ background: #fcfef5 url("images/bg/rightBG.png") no-repeat; background-position:top right; word-spacing: .1em; color: #555; width:100%; font-family: georgia, garamond, times new roman; } /* Text */ #right_text p { font-size:12px; width:70%; z-index:0; position:relative; margin:auto; text-indent:15px; margin-top:5px; } /* end TEXT */ /* Links */ a img{ border:none; } #links a{ color:#999; text-decoration:none; } #links a:visited{ color:#555; } #links a:hover{ color:#889d46; } #links a:active{ color:#000; } /* end LINKS */ /* Containers */ #left_Area{ background: #d8dec3 url("images/BG/leftBG.png") no-repeat; background-position: top right; float:left; width:50%; min-height:100%; } #header{ width:100%; padding-top:237px; } #links{ width:100%; text-align:right; margin-right:10px; } #right_text{ float:left; position:relative; z-index:0; width:45%; padding-top:250px; } #introBox{ width:10px; margin-top:200px; display:block; opacity:.1; height:10px; background: #d8dec3 ; } /* Inner Containers */ #treeBG{ width:100%; height:235px; background: url("images/bg/treeBG.png") no-repeat; background-position:bottom left; } #mainLinks{ width:80%; margin:auto; padding:15px; } /* end INNER CONTAINERS */ /* Links List */ #links ul{ list-style:none; padding:10px; } #links li{ padding:10px; background: #d8dec3; margin:5px; -moz-border-radius: 10px; z-index:1; position:relative; color: #889d46; font-family:tahoma ms, verdana; font-size:13px; } /* end LINKS LEST */ /* Images */ .mainHeader{ margin:10px; } #mainImg{ margin: 10px 20px; } /* Classes */ .clear{ clear:both; } HTML: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Website coded By ZACH! --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> Zach W Portfolio - Grade 10 Section</title> <link rel="stylesheet" href="styleFF.css" type="text/css"/> <script> function roll_over(img_name, img_src) { document[img_name].src = img_src; } </script> <script src="jquery/doc.js" type="text/javascript"></script> <script> $(document).ready(function(){ $('li').mouseenter(function(){ $(this).animate({ width:'135%', opacity:'.92' }, 'slow' ); }); $('li').mouseleave(function(){ $(this).animate({ width:'96%' }, 'fast' ); }); $('a').click(function(){ $('body').fadeOut(); }); }); </script> </head> <body> <div id="left_Area"> <div id="header"></div> <div id="links"> <ul> <li><a href="index.php">BACK TO <br/> DIRECTORY </a> </li> <li><a href="">Goals</a></li> <li> Skills Analysis </li> </ul> </div> <div id="treeBG"></div> </div> <div id="right_text"> <p> I came to TVHS on February 2nd, 2009, and I absolutely love the school. I approach the end of the first half of my high school career, and this portfolio will display some work that I’ve done in my four months at Tech Valley High. The portfolio will also be an exhibit for my possible future, and a medium for me to display my skills. </p> <p>Well, I’ve grown up in New York State, though this hasn’t inhibited me from experiencing the culture of other parts of the world and the country. My Mom, brother, and I all live together; my Dad lives a mere 30 minutes from my house. At this point, I’ve taken four years of Spanish, four months of (unofficial) Chinese, and I can speak little bits of a whole bunch of other languages (including English). I love to draw, and since I was little I’ve loved to read and write as well. It’s my goal to learn how to use the English language properly (as convoluted as it is). I don’t have any idea what I want to do when I grow up. Currently, I work at the Rensselaerville Library and I take traditional Okinawan Karate. Among my other interests are: tennis, wildlife, Eastern philosophy, and web design. </p> <p>There are probably more things than I realize that have shaped who I am now, but I can recall a few. My exposure to horror movies at a young age definitely drove me to draw and write because I seek to release a lot of creativity when I do those things…I assume that the horror movies are fueling my imagination. Another thing would be my grandmother (matrilineal) who literally had a library of books and a wealth of knowledge. Being exposed to knowledge as a child has proved to perpetually fuel my desire for knowing things now. I can’t recall anything else, except my constant exposure to the world and knowledge. </p> <p> As I continue through high school I develop more and more goals. I’m happy to say that being at TVHS has allowed me to prepare adequately for the working place. One goal that I have now is to learn to speak and write Chinese fluently! I wouldn’t have this goal if I hadn’t been exposed to Chinese here. I also want to travel all over the world to see ancient sites and artifacts before they are destroyed by the escapades of humans. That goal wasn’t influenced by the school I’ve had it for awhile. I have no idea what college I want to go to, but I know that I want to go. I might want to be an artist—maybe an author – maybe a webmaster…I won’t know for a little bit. </p> <p> I think my definite skills are tech literacy, self-direction, and critical thinking. I’ve been able to create websites and pictures for the yearbook; almost all of my homework has been done on time, save for a few instances and my self-direction grade is my highest grade. In this portfolio, you’ll see a drawing I did for the yearbook and many projects that I’ve done over the year, all of which will accentuate my skills. </p> </div> <div id="clear"></div> </body> </html>
  7. I've checked that code outside of my file, and it worked. Inside of my file, it does not and I don't know why. if(!empty($_POST['submit'])){ connect($db="government"); preg_replace('#\{{1,1}(.*?)\}{1,1}#',"<$1>", $message); echo $message; echo "<script>alert('Success!'); location='editCont.php?page=editNews';</script>"; }
  8. This is a function similar to BBCode. I would like something like "{u}Hello{/u}" to be changed into <u>Hello</u>. The code snippet I showed is just for left bracket, but I assumed I could go from there after learning what I'm doing wrong.
  9. I have a simple (?) preg_replace statement that I would like to replace a { with a <, but I keep getting it wrong and right now RegEx really confuses me, so help is appreciated. preg_replace("/(\{.*)/", "<", $message); Thanks in advance.
  10. Cool! That's helpful, thanks.
  11. I meant the blinky caret that marks where the text is written (that's what it's called in several forum topics I've found).
  12. Edit, I'm searching the forums...but additional help is welcome.
  13. So, I am working on this very small editing feature that I would like to behave like forums' BBCode insert things. I have searched high and low for a tutorial or something of the sort to detect where a caret is and then insert my code there.... ...I really want it to be slim, and it should work with a textarea. Any help? Thanks!!!
  14. Yay! Thanks. Now, what is the difference between "author" and "user" style sheets? I may know what they are, just by a different title.
  • 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.