Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP]Rozciągnięcie obrazka przy użyciu PHP?
Forum PHP.pl > Forum > PHP
Tracha
Witam!

Mam proste pewnie dla wielu pytanie, jak rozciągnąć obrazek przy użyciu PHP na całą ramke w której się znajduje?

Chodzi mi o logo na mojej stronie, nie jest rozciągnięte do 100% i czy jest jakiś sposób aby zamiast skalować w programie graficznym to rozciągnąć za pomocą PHP?


Pozdrawiam
Tracha
jmail
  1.  
  2. <img src="logo_jakies" style="Width:100%">
  3.  


używanie gd do rozciągania obrazków często ładowanych jest bez sensu bo po co zużywac zasoby serwera?

Ale gdybyś się uparł to można przy użyciu biblioteki GD http://pl2.php.net/manual/en/book.image.php
szalik
to już prędzej css i width: 100%; albo width o wymiarach ramki.
krowal
Zobacz sobie tą funkcję: http://pl.php.net/imagecopyresampled W pierwszym przykładzie tam masz wszystko podane tylko w drugą stronę smile.gif reszta to czysta matematyka i umiejętność czytania ze zrozumieniem winksmiley.jpg
pozdrawiam
Tracha
@jmail, wywalił mi błąd z brakiem przecinka albo średnika:

Cytat
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/tracha/domains/crowbar.xon.pl/public_html/themes/lsecure/theme.php on line 26
Pawel_W
to jest css, nie miał prawa spowodować błędu winksmiley.jpg
Fifi209
A forum to parser php? Nawet nie wiesz chyba o czym on mówił.

@paweł
Miał prawo pewnie zrobił:
  1. echo "<img src="logo_jakies" style="Width:100%">"

albo coś podobnego
jmail
Tracha a kod mółbyś tego pliku wkleić?
Tracha
PS. Wyczyściłem kod z tego kodu (Width 100%)

Kod
<?php
if (!defined("IN_FUSION")) { header("Location: ../../index.php"); exit; }
require_once INCLUDES."theme_functions_include.php";

// theme settings
$body_text = "#ffffff";
$body_bg = "#000000";
$theme_width = "90%";
$theme_width_l = "175";
$theme_width_r = "175";
// Right Panels off in Forum Mode
$theme_panels_exclude = array("/forum/");

function render_header($header_content) {

global $theme_width;

echo "<table align='center' cellspacing='0' cellpadding='0' width='$theme_width' class='outer-border'>
<tr>
<td>
<table cellpadding='0' cellspacing='0' width='100%'>
<tr>
<td class='full-header'>
<table cellpadding='0' cellspacing='0' width='100%'>
<tr>
<td width='100%' height='108' class='top-t'><center><a href='".BASEDIR."index.php'><img src='".THEME."images/logo.jpg'></a></center></td>
</tr>
</table>
</td>
</tr>
</table>\n";

echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>
<td background=\"".THEME."images/panel.png\" class='white-header'>".showsublinks("?")."</td>
<td background=\"".THEME."images/panel.png\" align='right' class='white-header'>".showsubdate()."</td>
</tr>
</table>\n";

echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n";

}

function render_footer($license=false) {

global $theme_width,$settings;

echo "</tr>\n</table>\n";
echo "<table cellpadding='0' cellspacing='0' width='100%'>
<tr>
<td align='center' class='footer'>".stripslashes($settings['footer'])."<br>\n";
if (!$license) { echo showcopyright("white")."<br><a href='".THEME."copyright.php' onClick=\"MyWindow=window.open('".THEME."copyright.php','copyright','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,res
izable=no,width=420,height=200'); return false;\"><center><font color='#A29871'><b>Half Life II Theme Modified By Tracha</b></font></a></center><br>\n"; } echo showcounter()."<br><br>
</td>
</tr>
</table>
</td>
</tr>
</table>\n";

}

function render_news($subject, $news, $info) {

echo "<table cellpadding='0' cellspacing='0' width='100%' class='border'>
<tr>
<td background=\"".THEME."images/panel.png\" class='capmain' align='left'><span class='s1'>$subject</span></td>
</tr>
<tr>
<td class='main-body'>$news</td>
</tr>
<tr>
<td align='center' class='news-footer'>\n";
echo openform("N",$info['news_id']).newsposter($info,"").newsopts($info,"?").closeform("N",$info['news_id']);
echo "</td>
</tr>
</table>\n";

}

function render_article($subject, $article, $info) {
    
echo "<table width='100%' cellpadding='0' cellspacing='0' class='border'>
<tr>
<td background=\"".THEME."images/panel.png\" class='capmain'>$subject</td>
</tr>
<tr>
<td class='main-body'>
".($info['article_breaks'] == "y" ? nl2br($article) : $article)."
</td>
</tr>
<tr>
<td align='center' class='news-footer'>\n";
echo openform("A",$info['article_id']).articleposter($info,"<br>").articleopts($info,"?").closeform("A",$info['article_id']);
echo "</td>
</tr>
</table>\n";

}

function opentable($title) {

echo "<table cellpadding='0' cellspacing='0' width='100%' class='border'>
<tr>
<td background=\"".THEME."images/panel.png\" class='capmain'>$title</td>
</tr>
<tr>
<td class='main-body'>\n";

}

function closetable() {

echo "</td>
</tr>
</table>\n";

}

function openside($title) {
    
echo "<table cellpadding='0' cellspacing='0' width='100%' class='border'>
<tr>

<td background=\"".THEME."images/panel.png\" class='scapmain'>$title</td>
</tr>
<tr>
<td class='side-body'>\n";

}

function closeside() {

echo "</td>
</tr>
</table>\n";
tablebreak();

}

function opensidex($title,$state="on") {

$boxname = str_replace(" ", "", $title);
echo "<table cellpadding='0' cellspacing='0' width='100%' class='border'>
<tr>
<td class='scapmain'>$title</td>
<td class='scapmain' align='right'>".panelbutton($state,$boxname)."</td>
</tr>
<tr>
<td colspan='2' class='side-body'>
<div id='box_$boxname'".($state=="off"?" style='display:none'":"").">\n";

}

function closesidex() {

echo "</div>
</td>
</tr>
</table>\n";
tablebreak();

}

function tablebreak() {

echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n<td height='5'></td>\n</tr>\n</table>\n";

}
?>
jmail
kurde biggrin.gif SOA 112 u mnie działa biggrin.gif
Tracha
Dodałem

Kod
width='100%'


I działa.

Btw. To jest transfero-żerne?
Bo ktoś coś mówił, że to dużo transferu żre.
kfc4
Jeżeli rozciągasz CSSem to tylko tyle co obrazek - skaluje już przeglądarka.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.