| | |
| Stránka: 1 z 1
| [ Príspevkov: 9 ] | |
Autor | Správa |
---|
Registrovaný: 13.01.07 Prihlásený: 17.05.10 Príspevky: 90 Témy: 35 Bydlisko: Prešov | Napísal M@tt21: 25.01.2009 15:02 | |
|
Nie som skuseny programator a preto potrebujem mensiu pomoc.
Takze. Urobil som stranku na jednom serveri. Script vyzeral asi takto:
Kód: <?php $url = fopen("http://domena.tld/fotky/kategoria/foto.php",r); fpassthru($url); ?>< Hoci domena.tld je tiez tam kde ten subor v ktorom je ten script, neriesil som tu root adresu ale takto mi to fungovalo. Ale potom som to prehodil na iny server (hosting), kde som zistil, ze je problem. Ma ochranu proti tejto funkcii (ak je spustana cez http.) A teraz mi vyhadzuje tento error: Kód: Kód: Warning: fopen() [function.fopen]: URL file-access is disabled in the server configuration in /domains1/do6xxx00/public/www_root/subor.php on line 9
Warning: fopen(http://domena.tld/fotky/kategoria/foto.php) [function.fopen]: failed to open stream: no suitable wrapper could be found in /domains1/do6xxx00/public/www_root/subor.php on line 9
Warning: fpassthru(): supplied argument is not a valid stream resource in /domains1/do6xxx00/public/www_root/subor.php on line 10 Snažil som sa to urpavi´t tak, aby to tam fungovalo. Tak som niečo take vykúzlil: Kód: <?php $url = fopen("./fotky/kategoria/foto.php",r); fpassthru($url); ?>
Avšak teraz mi už neincludne spustený php script, ale vypíše časť scriptu.
Ďakujem za pomoc a riešenie
|
|
Registrovaný: 27.07.07 Príspevky: 3948 Témy: 51 Bydlisko: Bratislava |
include pouzit nemozes?
_________________ NTB: Acer Aspire 4820TG 14" | CPU: Intel Core i5 2,53 GHz | VGA: ATI Mobility Radeon HD5650 1GB | RAM: 8GB DDR3 1066 MHz | HDD: 1TB SSD WD BLUE |
|
Registrovaný: 13.01.07 Prihlásený: 17.05.10 Príspevky: 90 Témy: 35 Bydlisko: Prešov | Napísal autor témy M@tt21: 25.01.2009 15:57 | |
|
totizto cez include sa ten script sprava cudne... ale aj v iclude by som musel dat abs. cestu
|
|
Registrovaný: 27.07.07 Príspevky: 3948 Témy: 51 Bydlisko: Bratislava |
ako ze cudne? alebo skus curl... ale to radsej potom relativne adresy...
_________________ NTB: Acer Aspire 4820TG 14" | CPU: Intel Core i5 2,53 GHz | VGA: ATI Mobility Radeon HD5650 1GB | RAM: 8GB DDR3 1066 MHz | HDD: 1TB SSD WD BLUE |
|
Registrovaný: 13.01.07 Prihlásený: 17.05.10 Príspevky: 90 Témy: 35 Bydlisko: Prešov | Napísal autor témy M@tt21: 25.01.2009 16:22 | |
|
Lebo to foto.php je script na to, aby vypisal fotky z daneho priecika /kategorie/. Ked to hodim cez include tak vypisuje vsetky mozne obrazky od rootu.
|
|
Registrovaný: 27.07.07 Príspevky: 3948 Témy: 51 Bydlisko: Bratislava |
sak si nastav adresar, v ktorom ma fotky hladat...
_________________ NTB: Acer Aspire 4820TG 14" | CPU: Intel Core i5 2,53 GHz | VGA: ATI Mobility Radeon HD5650 1GB | RAM: 8GB DDR3 1066 MHz | HDD: 1TB SSD WD BLUE |
|
Registrovaný: 13.01.07 Prihlásený: 17.05.10 Príspevky: 90 Témy: 35 Bydlisko: Prešov | Napísal autor témy M@tt21: 25.01.2009 17:34 | |
|
Tu j ten script na fotky:
foto.php
Kód: <?php
$directory = getcwd();
$directories = array(); getListOfDirectories( $directories, $directory );
// Max width of image thumbnail $max_width = 180; // Max height of image thumbnail $max_height = 150; // Max number of images per row of the table $images_per_row = 2;
$directories = array_flip($directories); foreach( $directories as $directory => $foo){ $directories[ $directory ] = array(); $directory_reader = dir($directory); // Get a list of images while (false !== ($filename = $directory_reader->read())) { if( preg_match( "~.*\.(gif|jpg|jpeg|png)~Ui", $filename, $matches ) ){ $directories[ $directory ][] = $filename; } } $directory_reader->close(); }
function getListOfDirectories( &$directories, $current_directory ){ $directories[] = $current_directory; $directory_reader = dir($current_directory); while (false !== ($filename = $directory_reader->read())) { if( is_dir( $current_directory . '/' . $filename ) && $filename[0] != '.'){ getListOfDirectories( $directories, $current_directory . '/' . $filename ); } } } ?>
<table> <?php
// Render the images in their rows foreach( $directories as $directory => $images ){ $directory = substr( $directory, strlen( getcwd() ) + 1 ); echo ( str_replace ( array( '[[images_per_row]]', '[[directory_name]]', ), array( $images_per_row, ($directory)?$directory:'[[current]]' ), '' ) ); $rows = ceil(count($images)/$images_per_row); for( $y = 0; $y < $rows; $y++ ){ echo( '<tr>' ); for( $x = 0; $x < $images_per_row; $x++ ){ $index = $x + ( $y * $images_per_row ); if( $index < count( $images ) ){ echo ( str_replace ( array( '[[path]]', '[[image_name]]', '[[width]]', '[[height]]' ), array( (($directory)?$directory.'/':''), $images[ $index ], $max_width, $max_height ), '<td align="center"><a href="[[path]][[image_name]]" rel="lightbox[roadtrip]"><img border="0" src="get_image.php?image_name=[[path]][[image_name]]&width=[[width]]&height=[[height]]" alt="[[image_name]]"></a></td>' ) ); } } echo( '</tr>' ); } } ?> </table> get_image.php Kód: <?php
$image_name = './' . $_GET[ 'image_name' ];
$output_width = $_GET[ 'width' ]; $output_height = $_GET[ 'height' ];
$types = array( 'jpeg' => 'image/jpeg', 'gif' => 'image/gif', 'png' => 'image/png', );
if( preg_match( "~.*\.(gif|jpg|jpeg|png)~Ui", $image_name, $matches ) ){
$format = $matches[ 1 ]; if( $format == 'jpg' ){ $format = 'jpeg'; } switch( $format ){ case 'gif':{ $image = imagecreatefromgif( $image_name ); break; } case 'jpeg':{ $image = imagecreatefromjpeg( $image_name ); break; } case 'png':{ $image = imagecreatefrompng( $image_name ); break; } }
// obtain source image dimensions list( $width, $height, $type ) = getimagesize( $image_name );
// By default, w/h are the same as the requested output size $new_height = $output_height; $new_width = $output_width;
// Do we have to shrink it horizontally or vertically? $ratio_current = $width / $height; $ratio_output = $output_width / $output_height; if( $ratio_current > $ratio_output ){ // New ratio is wider/shorter than old $new_height = $height / ( $width / $output_width ); } elseif ( $ratio_current < $ratio_output ) { // New ratio is taller/thinner than old $new_width = $width / ( $height / $output_height ); }
// Create a blank image $target = imagecreatetruecolor ( $new_width, $new_height );
// Copy resized image into blank image imagecopyresampled( $target, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height );
// Clean up in-memory objects imagedestroy( $image );
header("Content-Type: " . $types[ $format ]);
imagejpeg($target); } ?>
Ten script je tak urobeny, ze berie fotky z tamadial, kde sa to .php nachaza. Mohol by mi to niekto upravit, ze sa na tvrdo nastavi priecinok?
Dakujem
|
|
Registrovaný: 27.07.07 Príspevky: 3948 Témy: 51 Bydlisko: Bratislava |
pre zaciatok ti bude stacit zmenit prvy riadok na
Kód: $directory = "fotky/kategoria";
ak mas ten skript v roote...
_________________ NTB: Acer Aspire 4820TG 14" | CPU: Intel Core i5 2,53 GHz | VGA: ATI Mobility Radeon HD5650 1GB | RAM: 8GB DDR3 1066 MHz | HDD: 1TB SSD WD BLUE |
|
Registrovaný: 13.01.07 Prihlásený: 17.05.10 Príspevky: 90 Témy: 35 Bydlisko: Prešov | Napísal autor témy M@tt21: 26.01.2009 12:25 | |
|
Ďakujem, FUNGUJE to!
Ešte by som sa chcel spýtať, či by niekto nevedel ten script upraviť tak, aby vygeneroval a uložil thumbnail do nejakeho priečinka, napr, /thumb/, lebo keď ten sa stale spusta, stale generuje nove thumby, a server je dost zatazeny.
Dakujem
|
|
| Stránka: 1 z 1
| [ Príspevkov: 9 ] | |
Podobné témy | Témy | Odpovede | Zobrazenia | Posledný príspevok |
---|
| Prepisanie cesty ukladania blokov v Bitcoin v Ostatné programy | 5 | 413 | 04.12.2013 13:08 Kraliček | | Prepisanie css v HTML, XHTML, XML, CSS | 2 | 510 | 30.10.2007 14:57 pitrik1 | | prepisanie grub v Operačné systémy Unix a Linux | 20 | 1517 | 30.08.2006 10:28 Intelman | | Prepisanie diskov v Ostatné zariadenia | 2 | 402 | 18.05.2015 11:31 shiro | | Prepísanie používateľa v Operačné systémy Microsoft | 1 | 377 | 24.11.2011 16:46 HGDS1 | | prepisanie znaku assembler v Assembler, C, C++, Pascal, Java | 4 | 297 | 06.03.2013 18:42 XOLOO | | Prepisanie ntdll.ll v Operačné systémy Microsoft | 1 | 483 | 03.05.2009 21:13 shiro | | Prepísanie disku na nuly v Pevné disky a radiče | 9 | 531 | 04.09.2016 14:57 4040 | | Príčíny nabúrania-prepísanie indexu v PHP, ASP | 9 | 572 | 15.07.2010 22:59 qacer | | php_mysql-prepisanie id problem v PHP, ASP | 2 | 512 | 05.10.2009 15:22 pilná lama glama | | Prepisanie suboru cez web v PHP, ASP | 6 | 618 | 15.07.2007 18:05 suchy | | Prepísanie partícií windows s freebsd v Operačné systémy Unix a Linux | 0 | 354 | 10.03.2012 15:26 drioton | | Prepisanie Return-Path v Postfixe v Operačné systémy Unix a Linux | 0 | 475 | 17.09.2016 12:31 JanoF | | Spätné prepísanie omylom prepisanej menovky disku v Pevné disky a radiče | 3 | 403 | 19.11.2010 21:55 prandof | | Súhrnné cesty ... v Siete | 0 | 327 | 14.07.2010 13:49 RomanB | | Prepísanie buniek, ktoré už obsahujú dáta - výstraha v Ostatné programy | 4 | 457 | 02.06.2021 18:40 tatko Tom |
| Nemôžete zakladať nové témy v tomto fóre Nemôžete odpovedať na témy v tomto fóre Nemôžete upravovať svoje príspevky v tomto fóre Nemôžete mazať svoje príspevky v tomto fóre
|
|