Помощ за браузера

ci76

Registered
Имам галерия искам като отвори голямата снимка прозореза на браузера да е около нея кажете как
 
ако снимките са с еднаква височина и ширина знам ще стане лесно
 
Ами аз ги ресайзвам ама може и да не се получат с еднаква ширина и висояина то пропорционално ги намаля
 
знчи така става но ако картинките са с еднакви размери

Код:
<a onClick="open('http://burkoff.org', 'име','toolbar=0,location=0,history=0,resizable=0,width=284,height=300')" href="javascript:void(0)" color="#00ffcc">САЙТ</a>

мисля ч е е ясно слагаш твоето http:// ако е промениливо просто го дефинираш и можеш да свалиш стойностите на картинката за w h и да го предаваш на скрипта с някакри променливи
 
да точно там

и ще изглежда някакси така

<a onClick="open('ЛИНКА НА КАРТИНКАТА', 'име','toolbar=0,location=0,history=0,resizable=0,width=284,height=300')" href="javascript:void(0)" color="#00ffcc">пътя на малката картинка</a>

САМО ВНИМАВАЙ КАТО СМЕШСВАЩ С PHP

и дай са я видим тая галерия най накрая че не сам чел php кода
 
Записваш ли някъде картинките? дб или нещо друго или ги листваш от директория? как го правиш
 
нищо не ми се получава :cry:

ами записвам ги в две папки images i thumbs и в един файл който помни май коя снимка за коя голяма е вързана gallery.cfg

ако може да стане с база данни кажи как

ЕТО ТОВА Е ВКЛЮЧЕНО Е И ТВОЙТО ПРЕДЛОЖЕНИЕ :?



<LINK href="css/css.css" type=text/css rel=stylesheet>
<table border=0>


<div class="mt f">Галерия</div>
<div class="mg b">
<form method=post action="gallery.php" style="text-align:center;" enctype="multipart/form-data">
<table class="f3" align=center>

<tr>
<td align=right>Добави снимка: </td>
<td align=left><input name="photo" type="file" class="s" size=40></td>
</tr>
<tr>
<td align=right>Заглавие: </td>
<td align=left><input type="text" name="title" size=55 class="s"></td>
</tr>
<tr>
<td align=center colspan=2><input type="submit" value="Добави" class="s"> </td>
</tr>
</table>

<?php


# Качване на евентуални файлове

include "funcs.php";
$cfg = Array();
if(file_exists("../gallery/gallery.cfg")){
if(filesize("../gallery/gallery.cfg") > 0)
$cfg = unserialize(getfile("../gallery/gallery.cfg"));
}

if(basename($_GET["del"]) != ""){
unlink("../gallery/thumbs/".basename($_GET["del"]));
unlink("../gallery/images/".basename($_GET["del"]));
$cfg[basename($_GET["del"])]="";
unset($cfg[basename($_GET["del"])]);
$xml .= '<?xml version="1.0" encoding="UTF-8"?>
<simpleviewerGallery maxImageWidth="480" maxImageHeight="480" textColor="0xFFFFFF" frameColor="0xffffff" frameWidth="20" stagePadding="40" thumbnailColumns="3" thumbnailRows="3" navPosition="left" title="Галерия" enableRightClickOpen="true" backgroundImagePath="" imagePath="" thumbPath="">
';
foreach($cfg as $fl => $cap){
$xml.='<image><filename>'.$fl.'</filename><caption>'.mb_convert_encoding($cap, "UTF-8", "windows-1251").'</caption></image>';
}
$xml.='</simpleviewerGallery>';
setfile("../gallery/gallery.xml", $xml);

setfile("../gallery/gallery.cfg", serialize($cfg));
}

$fstatus = Array();
$directory = getpath(__FILE__)."../gallery/";
if(count($_FILES) > 0){
foreach($_FILES as $p => $file){
if($file["name"] != ""){
$cnt = 0;
$file["name"] = str_replace(" ", "_", $file["name"]);
while(file_exists($directory.$file["name"]) == true){
$file["name"] = $cnt."_".$file["name"];
$cnt++;
}
if (move_uploaded_file($file["tmp_name"], $directory.$file["name"])){
$fstatus[$file["name"]] = true;
# image was uploaded => resize (twice)
$fileR = $directory.$file["name"];
$what = getimagesize($fileR);
switch( $what['mime'] ){
case 'image/png' : $src_id = imagecreatefrompng($fileR); break;
case 'image/jpeg': $src_id = imagecreatefromjpeg($fileR); break;
case 'image/gif' : $old_id = imagecreatefromgif($fileR); $src_id = imagecreatetruecolor($what[0],$what[1]); imagecopy($src_id,$old_id,0,0,0,0,$what[0],$what[1]); break;
default: break;
}
list($width, $height) = getimagesize($fileR);
$w = $width; $h = $height;
if($width > $height){
$ratio = $width / 600;
$width = 600;
$height = floor($height / $ratio);
}
else{
$ratio = $height / 600;
$height = 600;
$width = floor($width / $ratio);
}
if($width > $height){
$ratio = $width / 87;
$width_t = 87;
$height_t = floor($height / $ratio);
}
else{
$ratio = $height / 87;
$height_t = 87;
$width_t = floor($width / $ratio);
}
$image_new = imagecreatetruecolor($width, $height);
$image_thumb = imagecreatetruecolor($width_t, $height_t);
imagecopyresampled($image_new, $src_id, 0, 0, 0, 0, $width, $height, $w, $h);
imagecopyresampled($image_thumb, $src_id, 0, 0, 0, 0, $width_t, $height_t, $w, $h);
imagejpeg ($image_new, $directory."images/".$file["name"], 80);
imagejpeg ($image_thumb, $directory."thumbs/".$file["name"], 80);

if(file_exists("../gallery/".$file["name"])) unlink("../gallery/".$file["name"]);

# set .cfg file

$cfg[$file["name"]] = htmlspecialchars(stripslashes($_POST["title"]), ENT_QUOTES);
setfile("../gallery/gallery.cfg", serialize($cfg));
# build XML
$xml .= '<?xml version="1.0" encoding="UTF-8"?>
<simpleviewerGallery maxImageWidth="480" maxImageHeight="480" textColor="0xFFFFFF" frameColor="0xffffff" frameWidth="20" stagePadding="40" thumbnailColumns="3" thumbnailRows="3" navPosition="left" title="Галерия" enableRightClickOpen="true" backgroundImagePath="" imagePath="" thumbPath="">
';
foreach($cfg as $fl => $cap){
$xml.='<image><filename>'.$fl.'</filename><caption>'.mb_convert_encoding($cap, "UTF-8", "windows-1251").'</caption></image>';
}
$xml.='</simpleviewerGallery>';
setfile("../gallery/gallery.xml", $xml);
}
else{ $fstatus[$file["name"]] = false; }
}
}
}
'<table width=100%><tr>'


;
$c = 1;


if ($handle = opendir('../gallery/thumbs/')) {
while (false !== ($file = readdir($handle))) {
print'

<td><a onClick="open(<a href="../gallery/images/'.$file.'" target="open.php">, 'име','toolbar=0,location=0,history=0,resizable=0,width=284,height=300')" href="javascript:void(0)" color="#00ffcc"><img src="../gallery/thumbs/'.$file.'" class="img"></a>



<Td><a href="../gallery/images/'.$file.'" target="open.php"><img src="../gallery/thumbs/'.$file.'" class="img"></a>   '.$cfg["$file"].' <a href="gallery.php?del='.$file.'">[X]</a></td>';
if($c == 6){ $c = 0;
print'</tr><tr height=8><td colspan=6></td></tr>'; }
$c++;
}
}
closedir($handle);?>


</tr></table>
</div>
 
Не е пробвано да знаеш. Нямам къде да пробвам, че съм на работа.

Код:
<?php

$myimg = "http://www.google.com/images/logo.gif";
list($width, $height, $type, $attr) = getimagesize($myimg);

$widthh=("$width+10");
$heightt=("$height+10");

echo "<a onClick=\"open('$myimg', 'име','toolbar=0,location=0,history=0,resizable=0,width=$widthh,height=$heightt')\" href=\"javascript:void(0)\" color=\"#00ffcc\">Картинка</a>";
?>

П.П. ще ти даде грешка . няма да стане. сега ще го оправя

ето го готово

Код:
<?php

$myimg = "http://www.google.com/images/logo.gif";
list($width, $height, $type, $attr) = getimagesize($myimg);

$widthh=$width+20;
$heightt=$height+20;

?>
<a onClick="open('<?php echo "$myimg" ?>', 'име','toolbar=0,location=0,history=0,resizable=0,width=<?php echo "$widthh"; ?>,height=<?php echo "$heightt"; ?>')" href="javascript:void(0)" color="#00ffcc">Картинка</a>


http://webjo.no-ip.org/test1/popup_resaze.php
 
горе при $myimg = "http://www.google.com/images/logo.gif"; какво трябва да сложа там те са ми в папка image обаче са доста не е една променливата е $file
 
ci76 каза:
горе при $myimg = "http://www.google.com/images/logo.gif"; какво трябва да сложа там те са ми в папка image обаче са доста не е една променливата е $file


$myimg="../gallery/images/'.$file.'";
 
Parse error: parse error, unexpected '<' in c:\www\otzwuk\admin\gallery.php on line 142
има някъде грешка ама не знам къде

<? php
$myimg = "../gallery/images/'.$file.'";
list($width, $height, $type, $attr) = getimagesize($myimg);

$widthh=$width+20;
$heightt=$height+20;

?>
<a onClick="open('<?php echo "$myimg"; ?>', 'име','toolbar=0,location=0,history=0,resizable=0,width=<?php echo "$width"; ?>,height=<?php echo "$height"; ?>')" href="javascript:void(0)" color="#00ffcc"><img src="../gallery/thumbs/'.$file.'" class="img"></a>
 
така?

Код:
<LINK href="css/css.css" type=text/css rel=stylesheet> 
<table border=0> 


<div class="mt f">Галерия</div> 
<div class="mg b"> 
<form method=post action="gallery.php" style="text-align:center;" enctype="multipart/form-data"> 
<table class="f3" align=center> 

<tr> 
<td align=right>Добави снимка: </td> 
<td align=left><input name="photo" type="file" class="s" size=40></td> 
</tr> 
<tr> 
<td align=right>Заглавие: </td> 
<td align=left><input type="text" name="title" size=55 class="s"></td> 
</tr> 
<tr> 
<td align=center colspan=2><input type="submit" value="Добави" class="s"> </td> 
</tr> 
</table> 

<?php 


# Качване на евентуални файлове 

include "funcs.php"; 
$cfg = Array(); 
if(file_exists("../gallery/gallery.cfg")){ 
if(filesize("../gallery/gallery.cfg") > 0) 
$cfg = unserialize(getfile("../gallery/gallery.cfg")); 
} 

if(basename($_GET["del"]) != ""){ 
unlink("../gallery/thumbs/".basename($_GET["del"])); 
unlink("../gallery/images/".basename($_GET["del"])); 
$cfg[basename($_GET["del"])]=""; 
unset($cfg[basename($_GET["del"])]); 
$xml .= '<?xml version="1.0" encoding="UTF-8"?> 
<simpleviewerGallery maxImageWidth="480" maxImageHeight="480" textColor="0xFFFFFF" frameColor="0xffffff" frameWidth="20" stagePadding="40" thumbnailColumns="3" thumbnailRows="3" navPosition="left" title="Галерия" enableRightClickOpen="true" backgroundImagePath="" imagePath="" thumbPath=""> 
'; 
foreach($cfg as $fl => $cap){ 
$xml.='<image><filename>'.$fl.'</filename><caption>'.mb_convert_encoding($cap, "UTF-8", "windows-1251").'</caption></image>'; 
} 
$xml.='</simpleviewerGallery>'; 
setfile("../gallery/gallery.xml", $xml); 

setfile("../gallery/gallery.cfg", serialize($cfg)); 
} 

$fstatus = Array(); 
$directory = getpath(__FILE__)."../gallery/"; 
if(count($_FILES) > 0){ 
foreach($_FILES as $p => $file){ 
if($file["name"] != ""){ 
$cnt = 0; 
$file["name"] = str_replace(" ", "_", $file["name"]); 
while(file_exists($directory.$file["name"]) == true){ 
$file["name"] = $cnt."_".$file["name"]; 
$cnt++; 
} 
if (move_uploaded_file($file["tmp_name"], $directory.$file["name"])){ 
$fstatus[$file["name"]] = true; 
# image was uploaded => resize (twice) 
$fileR = $directory.$file["name"]; 
$what = getimagesize($fileR); 
switch( $what['mime'] ){ 
case 'image/png' : $src_id = imagecreatefrompng($fileR); break; 
case 'image/jpeg': $src_id = imagecreatefromjpeg($fileR); break; 
case 'image/gif' : $old_id = imagecreatefromgif($fileR); $src_id = imagecreatetruecolor($what[0],$what[1]); imagecopy($src_id,$old_id,0,0,0,0,$what[0],$what[1]); break; 
default: break; 
} 
list($width, $height) = getimagesize($fileR); 
$w = $width; $h = $height; 
if($width > $height){ 
$ratio = $width / 600; 
$width = 600; 
$height = floor($height / $ratio); 
} 
else{ 
$ratio = $height / 600; 
$height = 600; 
$width = floor($width / $ratio); 
} 
if($width > $height){ 
$ratio = $width / 87; 
$width_t = 87; 
$height_t = floor($height / $ratio); 
} 
else{ 
$ratio = $height / 87; 
$height_t = 87; 
$width_t = floor($width / $ratio); 
} 
$image_new = imagecreatetruecolor($width, $height); 
$image_thumb = imagecreatetruecolor($width_t, $height_t); 
imagecopyresampled($image_new, $src_id, 0, 0, 0, 0, $width, $height, $w, $h); 
imagecopyresampled($image_thumb, $src_id, 0, 0, 0, 0, $width_t, $height_t, $w, $h); 
imagejpeg ($image_new, $directory."images/".$file["name"], 80); 
imagejpeg ($image_thumb, $directory."thumbs/".$file["name"], 80); 

if(file_exists("../gallery/".$file["name"])) unlink("../gallery/".$file["name"]); 

# set .cfg file 

$cfg[$file["name"]] = htmlspecialchars(stripslashes($_POST["title"]), ENT_QUOTES); 
setfile("../gallery/gallery.cfg", serialize($cfg)); 
# build XML 
$xml .= '<?xml version="1.0" encoding="UTF-8"?> 
<simpleviewerGallery maxImageWidth="480" maxImageHeight="480" textColor="0xFFFFFF" frameColor="0xffffff" frameWidth="20" stagePadding="40" thumbnailColumns="3" thumbnailRows="3" navPosition="left" title="Галерия" enableRightClickOpen="true" backgroundImagePath="" imagePath="" thumbPath=""> 
'; 
foreach($cfg as $fl => $cap){ 
$xml.='<image><filename>'.$fl.'</filename><caption>'.mb_convert_encoding($cap, "UTF-8", "windows-1251").'</caption></image>'; 
} 
$xml.='</simpleviewerGallery>'; 
setfile("../gallery/gallery.xml", $xml); 
} 
else{ $fstatus[$file["name"]] = false; } 
} 
} 
} 
'<table width=100%><tr>' 


; 
$c = 1; 


if ($handle = opendir('../gallery/thumbs/')) { 
while (false !== ($file = readdir($handle))) { 
print' 

<td>';
 

$myimg = ""../gallery/images/'.$file.'"; 
list($width, $height, $type, $attr) = getimagesize($myimg); 

$widthh=$width+20; 
$heightt=$height+20; 

?> 
<a onClick="open('<?php echo "$myimg" ?>', 'име','toolbar=0,location=0,history=0,resizable=0,width=<?php echo "$widthh"; ?>,height=<?php echo "$heightt"; ?>')" href="javascript:void(0)" color="#00ffcc"><img src="../gallery/thumbs/<?php echo $file; ?>" class="img"></a>
<?php
<Td><a href="../gallery/images/'.$file.'" target="open.php"><img src="../gallery/thumbs/'.$file.'" class="img"></a>   '.$cfg["$file"].' <a href="gallery.php?del='.$file.'">[X]</a></td>'; 
if($c == 6){ $c = 0; 
print'</tr><tr height=8><td colspan=6></td></tr>'; } 
$c++; 
} 
} 
closedir($handle);?> 


</tr></table> 
</div>
 
Parse error: parse error, unexpected '<' in c:\www\otzwuk\admin\gallery.php on line 1
незнам обикновенно едитора в който пища ми оцветява в различен цвят променливите а долу вече не саоцветени и за това си мисля че има някъде грешка ама не мога да я намеря
 
не е на първи :) виж :
Parse error: parse error, unexpected T_STRING in c:\www\otzwuk\admin\gallery.php on line 146
имаше нещо горе изтрих го
 
намерих грешката:

Код:
<LINK href="css/css.css" type=text/css rel=stylesheet> 
<table border=0> 


<div class="mt f">Галерия</div> 
<div class="mg b"> 
<form method=post action="gallery.php" style="text-align:center;" enctype="multipart/form-data"> 
<table class="f3" align=center> 

<tr> 
<td align=right>Добави снимка: </td> 
<td align=left><input name="photo" type="file" class="s" size=40></td> 
</tr> 
<tr> 
<td align=right>Заглавие: </td> 
<td align=left><input type="text" name="title" size=55 class="s"></td> 
</tr> 
<tr> 
<td align=center colspan=2><input type="submit" value="Добави" class="s"> </td> 
</tr> 
</table> 

<?php 


# Качване на евентуални файлове 

include "funcs.php"; 
$cfg = Array(); 
if(file_exists("../gallery/gallery.cfg")){ 
if(filesize("../gallery/gallery.cfg") > 0) 
$cfg = unserialize(getfile("../gallery/gallery.cfg")); 
} 

if(basename($_GET["del"]) != ""){ 
unlink("../gallery/thumbs/".basename($_GET["del"])); 
unlink("../gallery/images/".basename($_GET["del"])); 
$cfg[basename($_GET["del"])]=""; 
unset($cfg[basename($_GET["del"])]); 
$xml .= '<?xml version="1.0" encoding="UTF-8"?> 
<simpleviewerGallery maxImageWidth="480" maxImageHeight="480" textColor="0xFFFFFF" frameColor="0xffffff" frameWidth="20" stagePadding="40" thumbnailColumns="3" thumbnailRows="3" navPosition="left" title="Галерия" enableRightClickOpen="true" backgroundImagePath="" imagePath="" thumbPath=""> 
'; 
foreach($cfg as $fl => $cap){ 
$xml.='<image><filename>'.$fl.'</filename><caption>'.mb_convert_encoding($cap, "UTF-8", "windows-1251").'</caption></image>'; 
} 
$xml.='</simpleviewerGallery>'; 
setfile("../gallery/gallery.xml", $xml); 

setfile("../gallery/gallery.cfg", serialize($cfg)); 
} 

$fstatus = Array(); 
$directory = getpath(__FILE__)."../gallery/"; 
if(count($_FILES) > 0){ 
foreach($_FILES as $p => $file){ 
if($file["name"] != ""){ 
$cnt = 0; 
$file["name"] = str_replace(" ", "_", $file["name"]); 
while(file_exists($directory.$file["name"]) == true){ 
$file["name"] = $cnt."_".$file["name"]; 
$cnt++; 
} 
if (move_uploaded_file($file["tmp_name"], $directory.$file["name"])){ 
$fstatus[$file["name"]] = true; 
# image was uploaded => resize (twice) 
$fileR = $directory.$file["name"]; 
$what = getimagesize($fileR); 
switch( $what['mime'] ){ 
case 'image/png' : $src_id = imagecreatefrompng($fileR); break; 
case 'image/jpeg': $src_id = imagecreatefromjpeg($fileR); break; 
case 'image/gif' : $old_id = imagecreatefromgif($fileR); $src_id = imagecreatetruecolor($what[0],$what[1]); imagecopy($src_id,$old_id,0,0,0,0,$what[0],$what[1]); break; 
default: break; 
} 
list($width, $height) = getimagesize($fileR); 
$w = $width; $h = $height; 
if($width > $height){ 
$ratio = $width / 600; 
$width = 600; 
$height = floor($height / $ratio); 
} 
else{ 
$ratio = $height / 600; 
$height = 600; 
$width = floor($width / $ratio); 
} 
if($width > $height){ 
$ratio = $width / 87; 
$width_t = 87; 
$height_t = floor($height / $ratio); 
} 
else{ 
$ratio = $height / 87; 
$height_t = 87; 
$width_t = floor($width / $ratio); 
} 
$image_new = imagecreatetruecolor($width, $height); 
$image_thumb = imagecreatetruecolor($width_t, $height_t); 
imagecopyresampled($image_new, $src_id, 0, 0, 0, 0, $width, $height, $w, $h); 
imagecopyresampled($image_thumb, $src_id, 0, 0, 0, 0, $width_t, $height_t, $w, $h); 
imagejpeg ($image_new, $directory."images/".$file["name"], 80); 
imagejpeg ($image_thumb, $directory."thumbs/".$file["name"], 80); 

if(file_exists("../gallery/".$file["name"])) unlink("../gallery/".$file["name"]); 

# set .cfg file 

$cfg[$file["name"]] = htmlspecialchars(stripslashes($_POST["title"]), ENT_QUOTES); 
setfile("../gallery/gallery.cfg", serialize($cfg)); 
# build XML 
$xml .= '<?xml version="1.0" encoding="UTF-8"?> 
<simpleviewerGallery maxImageWidth="480" maxImageHeight="480" textColor="0xFFFFFF" frameColor="0xffffff" frameWidth="20" stagePadding="40" thumbnailColumns="3" thumbnailRows="3" navPosition="left" title="Галерия" enableRightClickOpen="true" backgroundImagePath="" imagePath="" thumbPath=""> 
'; 
foreach($cfg as $fl => $cap){ 
$xml.='<image><filename>'.$fl.'</filename><caption>'.mb_convert_encoding($cap, "UTF-8", "windows-1251").'</caption></image>'; 
} 
$xml.='</simpleviewerGallery>'; 
setfile("../gallery/gallery.xml", $xml); 
} 
else{ $fstatus[$file["name"]] = false; } 
} 
} 
} 
'<table width=100%><tr>' 


; 
$c = 1; 


if ($handle = opendir('../gallery/thumbs/')) { 
while (false !== ($file = readdir($handle))) { 
print' 

<td>'; 
  

$myimg = "../gallery/images/'.$file.'"; 
list($width, $height, $type, $attr) = getimagesize($myimg); 

$widthh=$width+20; 
$heightt=$height+20; 

?> 
<a onClick="open('<?php echo "$myimg" ?>', 'име','toolbar=0,location=0,history=0,resizable=0,width=<?php echo "$widthh"; ?>,height=<?php echo "$heightt"; ?>')" href="javascript:void(0)" color="#00ffcc"><img src="../gallery/thumbs/<?php echo $file; ?>" class="img"></a> 
<?php 
echo '<Td><a href="../gallery/images/'.$file.'" target="open.php"><img src="../gallery/thumbs/'.$file.'" class="img"></a>   '.$cfg["$file"].' <a href="gallery.php?del='.$file.'">[X]</a></td>'; 
if($c == 6){ $c = 0; 
print'</tr><tr height=8><td colspan=6></td></tr>'; } 
$c++; 
} 
} 
closedir($handle);?> 


</tr></table> 
</div>
 
ci76 каза:
махнах онова за триенето и се оправи ама сега как ще си ги трия

виж предишния ми пост. не стана ли с него? имах грешка която оправих
 
Така излизат и двете снимки но като кликна едната ми се отваря браузера по снимката ама като го разтегна пак става както преди в единия край
 

Back
Горе