Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> galeria
Arrow
post 20.05.2003, 09:24:42
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
maggot
post 20.05.2003, 09:33:29
Post #2





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

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


[php:1:4473f2196c]<?php
$rozmiar = file('$sciezka/$zdjecie.rozmiar');
?>[/php:1:4473f2196c]

To jest na pewno zle - pojedyncze cudzyslowy nie zamieniaja nazw zmiennych na ich wartosci (zamien je na " )


--------------------
/maggot/
Go to the top of the page
+Quote Post
Arrow
post 20.05.2003, 12:06:26
Post #3





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

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


otoz nie w tym blad to tu tylko tak mi sie wkleilo, nawet jesli to blad w tym miejscu nic nie zmienia warunek if z eregiem nie dziala, nie wiem dlaczego ten skrypt dziala na kilu serwerach bezblednie

sorkki to z przyzwyczajenia smile.gif nie wiedzialem biggrin.gif


--------------------
Pozdrawiam Bartosz
Go to the top of the page
+Quote Post
kurtz
post 20.05.2003, 12:30:16
Post #4





Grupa: Przyjaciele php.pl
Postów: 786
Pomógł: 0
Dołączył: 18.03.2002
Skąd: Wroclaw/Warszawa

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


Cytat
widzicie cos nie prawidlowego w tym skrypcie:
[php:1:c3f9297c24]<?php
[..]
if (ereg(".jpg$ |.gif$", $zdjecie))  
[..]
?>[/php:1:c3f9297c24]

usun spacje sprzed |
po jej usunieciu warunek jest uwgledniany.


pozdrawiam


--------------------
.. make web your home ..
Go to the top of the page
+Quote Post
Arrow
post 20.05.2003, 12:37:18
Post #5





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

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


eh dzieki ;d


--------------------
Pozdrawiam Bartosz
Go to the top of the page
+Quote Post
spenalzo
post 20.05.2003, 18:08:53
Post #6





Grupa: Zarejestrowani
Postów: 2 064
Pomógł: 1
Dołączył: 22.01.2003
Skąd: Poznań

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


[php:1:80f02b1df1]<?php
[..]
if (ereg(".jpg$ |.gif$", $zdjecie))
[..]
?>[/php:1:80f02b1df1]
W jakim celu stosuje się znak dolara po tekscie? I znacie jakiś dobry kurs wyrażeń?


--------------------

Go to the top of the page
+Quote Post
maggot
post 20.05.2003, 18:26:40
Post #7





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

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 Wersja Lo-Fi Aktualny czas: 14.07.2025 - 07:59