Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> wielkość banera
bronx
post
Post #1





Grupa: Zarejestrowani
Postów: 333
Pomógł: 0
Dołączył: 4.03.2004

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


witam

skrypt rotatpora banerów wygląda tak:

  1. <?php
  2. $banery = file(&#092;"banery/banery.php\"); 
  3.  
  4. srand ((float)microtime()*1000000); 
  5. shuffle($banery); 
  6. for($i=0;$i<1;$i++) { 
  7. list($url,$baner,$title) = explode('*|*', $banery[$i]);  
  8.  
  9.  
  10. echo '<a href=\"'.$url.'\" target=\"_blank\" title=\"'.$title.'\"><img
  11.  src=\"'.$baner.'\"><br>'.$title.'</a><br>'; 
  12. }
  13. ?>


i mam teraz taki problem: czy dało by się jakoś zrobić coś takiego że jeżeli baner ma długośc powyżej 420 to żeby dopisało mu width=420, a jeżeli jest mniejszy to żeby nic nie dopisywało...

nie wiem czy takie coś jest wykonalne, ale zapytać zawsze warto (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)

pozdrawiam
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 2)
Dabroz
post
Post #2





Grupa: Zarejestrowani
Postów: 286
Pomógł: 0
Dołączył: 1.11.2003
Skąd: Poland, Płock

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


  1. <?php
  2. $banery = file(&#092;"banery/banery.php\"); 
  3.  
  4. srand ((float)microtime()*1000000); 
  5. shuffle($banery); 
  6. for($i=0;$i<1;$i++) { 
  7.           list($url,$baner,$title) = explode('*|*', $banery[$i]);   
  8.  
  9. list($width, $height, $type, $attr) = getimagesize($baner);
  10.  
  11. echo  '<a href=\"'.$url.'\" target=\"_blank\" title=\"'.$title.'\"><img
  12. src=\"'.$baner.'\" '.  (($width>420)?'width=\"420\"':'') .'><br>'.$title.'</a><br>'; 
  13. }
  14. ?>


Ten post edytował Dabroz 19.07.2004, 22:01:14
Go to the top of the page
+Quote Post
a79rtur
post
Post #3





Grupa: Zarejestrowani
Postów: 331
Pomógł: 1
Dołączył: 23.05.2004
Skąd: Tarnów/Londyn

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


  1. <?php
  2.  
  3. .....
  4. echo '<a href=\"'.$url.'\" target=\"_blank\" title=\"'.$title.'\"><img
  5. src=\"'.$baner.'\"';
  6.  
  7. $rozmiar = getimagesize($baner);
  8.  
  9. if ($rozmiar[0]>420) {  
  10.  echo ' width=\"420\"';
  11. }
  12. echo ' ><br>'.$title.'</a><br>'; 
  13.  
  14.  
  15. ?>


a tu opis getimagesize
Go to the top of the page
+Quote Post

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

 



RSS Aktualny czas: 22.08.2025 - 15:38