Jump to content

fricx

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

fricx's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I just tried this regexp with common value, and it works, but with $_GET["value"] it doesnt.
  2. Hello, I am doing an ajax check of input form. I have java sending this.value to ajax-json.php which is doing a check and sending $error as json object back to java. Everything works fine, preg_match does it thing, but I want it to allow special charters like ćčšđž. My regexp looks like this right now: /^[a-z]+$/i I tried to add special charters: /^[a-z-šŠđĐžŽČčĆć]+$/i but it won't work. header(); is set to 'Content-type: application/json; charset=utf-8' and there should not be a problem, but again, it exists. If any of you guys can give me some hand with this, I would appreciate it. Regards.
  3. Thank you salathe, array_slice() never came on my mind. The thin I did was that I used asort function to sort images in array in ascending order and then used array_slice() to define number of images to show. Thank you very much !
  4. Hello, I am trying to list images from folder, and i have managed to that. But, I want to limit number of images the code will show. Here is my code: <?php $imgdir = 'uploads/image/'; $allowed_types = array('jpg','jpeg'); $a_img = glob($imgdir."*.{".implode(',',$allowed_types)."}",GLOB_BRACE); sort($a_img); echo '<table cellspacing="0" cellpadding="6"><tr>'; foreach ($a_img as $img) { if ($colCount % 6.5 == 0) echo "</tr><tr>"; $colCount++; $showimage = basename($img); echo '<td><div class="smallpic" style="width:100px;height:75px;"><a href="../index.php?pic='.$showimage.'"><img src="../uploads/image/'.$showimage.'" width="100" height="75" border="0" onclick="changeImg(velika, "'.$showimage.'")" /></a></div</td>'; } echo "</tr></table>"; ?> So my question is how to limit above code to show only for example 4 images.
  5. Did it ! Thank you Crayon once more ! You are a real PHP guru =))
  6. Yeahh, but somehow $img variable contains full path to image "uploads/nick/image.jpg" and I need only "image.jpg". Is that possible?
  7. It makes table right, but it doesn't insert images from folder I specified but from my main folder. Don't know why it does that? But thanks for the code.
  8. Hello, I am listing images from folder with this code: $imgdir = 'uploads/'.$nick.'/'; // the directory, where images are stored $allowed_types = array('png','jpg','jpeg','gif'); // list of filetypes I want to show $dimg = opendir($imgdir); while($imgfile = readdir($dimg)) { if(in_array(strtolower(substr($imgfile,-3)),$allowed_types)) { $a_img[] = $imgfile; sort($a_img); reset ($a_img); } } $totimg = count($a_img); // total image number for($x=0; $x < $totimg; $x++){ echo ' <div class="malaslika" style="width:100px;height:75px"><a href="../index.php?slika='.$a_img[$x].'"><img src="../uploads/'.$nick.'/'.$a_img[$x].'" width="100" height="75" border="0" onclick="changeImg(velika, "'.$kojaslika.'.jpg")" /></a></div>'; } Now, I want to list this in table with max 4 columns and not important how many rows. So the thing is how to insert images from for loop into table with 4 columns? Anyone can help? Thank you in advance.
×
×
  • 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.