Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> galeria
Arrow
post
Post #1





Grupa: Zarejestrowani
Postów: 43
Pomógł: 0
Dołączył: 5.05.2003

Ostrzeżenie: (0%)
-----


widzicie cos nie prawidlowego w tym skrypcie:
[php:1:a050d17467]<?php
$katalog = opendir(cos);
$i=0;
$sciezka = "cos";
while($zdjecie = readdir($katalog))
{
if (ereg(".jpg$ |.gif$", $zdjecie))
{
$i++;
$sciezka2 = "cos/duze";
$rozmiar = file('$sciezka/$zdjecie.rozmiar');

print "<a href="java script:powieksz('cosjpg','$sciezka2/$zdjecie','$rozmiar[2]','$rozmiar[0],'$rozmiar[1]')">n";
print "<img src=$sciezka/$zdjecie border='0' alt='powiększ....'></a><br><br>n";
print "$rozmiar[2]<br><br>";
}
}
closedir($katalog);
print "Obecnie zdjęć w galeri jest: <b>$i</b>n";
?>[/php:1:a050d17467]
wszedzie dziala tylko na pewnym serwerze nie wyswietla brak zdjec, gdyby pominac sprawdzenie rozszerzen to bylo by oki ,ale sa jeszcze plik ze opiem i romziarem zdjecia


--------------------
Pozdrawiam Bartosz
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
maggot
post
Post #2





Grupa: Zarejestrowani
Postów: 77
Pomógł: 0
Dołączył: 7.05.2002
Skąd: Sz-n/Wroc/Wawa

Ostrzeżenie: (0%)
-----


$ oznacza, ze zmienna zdjecie musi sie konczyc na .jpg lub ( | ) na .gif


Expression Description
t Tab character.
n New line.
. Matches any character.
| Either expression on its left and right side matches the target string. For example, "a|b" matches "a" and "b".
[] Any of the enclosed characters may match the target character. For example, "[ab]" matches "a" and "b". "[0-9]" matches any digit.
[^] None of the enclosed characters may match the target character. For example, "[^ab]" matches all character EXCEPT "a" and "b". "[^0-9]" matches any non-digit character.
* Character to the left of asterisk in the expression should match 0 or more times. For example "be*" matches "b", "be" and "bee".
+ Character to the left of plus sign in the expression should match 1 or more times. For example "be+" matches "be" and "bee" but not "b".
? Character to the left of question mark in the expression should match 0 or 1 time. For example "be?" matches "b" and "be" but not "bee".
^ Expression to the right of ^ matches only when it is at the beginning of line. For example "^A" matches an "A" that is only at the beginning of line.
$ Expression to the left of $ matches only when it is at the end of line. For example "e$" matches an "e" that is only at the end of line.
() Affects evaluation order of expression and also used for tagged expression.
Escape character. If you want to use character "" itself, you should use "".

The tagged expression is enclosed by (). Tagged expressions can be referenced by , 1, 2, 3, etc. indicates a tagged expression representing the entire substring that was matched. 1 indicates the first tagged expression, 2 is the second, etc. See following examples.

Original Search Replace Result
abc (ab)© -1-2 abc-ab-c
abc a(cool.gif© -1-2 abc-b-c
abc (a)b© -1-2 abc-a-c

a tu mozesz jeszcze wiecej o tym poczytac
http://www.php.net/manual/en/pcre.pattern.syntax.php


--------------------
/maggot/
Go to the top of the page
+Quote Post

Posty w temacie
- Arrow   galeria   20.05.2003, 09:24:42
- - maggot   <?php $rozmiar = file('$sciezka/$zdjecie.rozmia...   20.05.2003, 09:33:29
- - Arrow   otoz nie w tym blad to tu tylko tak mi sie wkleilo...   20.05.2003, 12:06:26
- - kurtz   Re: galeria   20.05.2003, 12:30:16
- - Arrow   eh dzieki ;d   20.05.2003, 12:37:18
- - spenalzo   Re: galeria   20.05.2003, 18:08:53
- - maggot   $ oznacza, ze zmienna zdjecie musi sie konczyc na ...   20.05.2003, 18:26:40


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 19.08.2025 - 22:53