wormy Posted January 4, 2008 Report Posted January 4, 2008 Kur ir kļūda ? <?php $filename = $_GET['file']; $percent = 0.2; $font = "arial"; $fontsize = 7; header('Content-type: image/jpeg'); list($width, $height) = getimagesize($filename); $new_width = $width * $percent; $new_height = $height * $percent; $image_p = imagecreatetruecolor($new_width + 2, $new_height + 20); $backgroundcolor = imagecolorallocate($image_p,5,90,177); $background = imagefill($image_p,0,0,$backgroundcolor); $image = imagecreatefromjpeg($filename); imagecopyresampled($image_p, $image, 1, 1, 0, 0, $new_width, $new_height, $width, $height); $tcolor = imagecolorallocate($image_p,255,255,255); $t = "Spied lai palielinātu " . $width . "x" . $height; $fontwidth = imagettfbbox($fontsize,0,$font,$t); $g = abs($fontwidth[1]) + abs($fontwidth[2]); imagettftext($image_p,$fontsize,0,$new_width / 2 - ($g / 2),$new_height + 14,$tcolor,$font,$t); imagejpeg($image_p, null, 100); ?> Uzrakstot index.php?file=bildes atrašanās vieta parāda nevis bildi, bet to pašu ko esu uzrakstījis iekš addres bar ! plz help šito ļoti vajag !
Mikijs Posted January 4, 2008 Report Posted January 4, 2008 tapec ka tev ir getimagesize($filename); un $filename = "bildes" nevis bildes.jpg ..
Mikijs Posted January 4, 2008 Report Posted January 4, 2008 ja nesanak tad varu ieteikt http://www.plus2net.com/php_tutorial/php_thumbnail.php
wormy Posted January 4, 2008 Author Report Posted January 4, 2008 (edited) Man nevajag uploadēt jau thumb, bet gan ģenerēt vai kā to var nosaukt ! Edited January 4, 2008 by wormy
Mikijs Posted January 4, 2008 Report Posted January 4, 2008 tip tev ir bilde bilde.jpg 800x600 un tu gribi ierakstot "index.php?generet=bilde.jpg" lai to genere piemeram uz -> bildes/thumb/bilde.jpg (100x100) ? ja sapratu pareizi tad varu kko pameklet
wormy Posted January 4, 2008 Author Report Posted January 4, 2008 (edited) Nē es laikam nepareizi kko pateicu, bet man tip vajag lai uzraxtot index.php?generet=bilde.jpg parāda bildi, jau kā thumb. Nu tip es ieraxtot <img src="http://mana_lapa.lv/index.php?generet=bilde.jpg"> jau parāda samazinātu bildes versiju ! Edited January 4, 2008 by wormy
Mikijs Posted January 4, 2008 Report Posted January 4, 2008 aa :D vienkars kods :d <?php $thumb = "100"; // Izmers if ($generet) generet($generet, $thumb); function generet($x, $y) { echo "<p align='center'><h2>Thumbs</h2><br><img src='".$x."' width='".$y."' border='0'>"; } ?> vajadzetu but pareizi =/
wormy Posted January 4, 2008 Author Report Posted January 4, 2008 (edited) Es jau to tā nedomāju ! :( vah es nemāku izskaidrot ! nju teiksim man ir 800x600 bilde un pieņemsim ka man ir ļoti lēns nets un ilgi to bildi lādē un to bildi tipa samazina ar php kodu nekur nesaglabājot to thumb bildi, līdz ar to ātrāk ielādētu to thumb ! Tavā kodā bildei ir tikai samazināti izmēri un tādēļ to bildi arī tik pat ilgi lādēs cik pilnajā izmērā ! P.S. kods darbojas, bet man tādu nevajadzēja ! sry :( Edited January 4, 2008 by wormy
Mikijs Posted January 4, 2008 Report Posted January 4, 2008 ok sapratu :D skatitaji jau aizravusies :D tulit bus :D Pag
wormy Posted January 4, 2008 Author Report Posted January 4, 2008 :D jā skatītāji ir samērā daudz :D ņemot vērā ka ir nakts xD
wormy Posted January 5, 2008 Author Report Posted January 5, 2008 (edited) nē ! es ar tām bildēm vēl nehuja nezinu ! bet tā ir viss skaidrs kas tur ir ! Edited January 5, 2008 by wormy
Mikijs Posted January 5, 2008 Report Posted January 5, 2008 noprotu ka kodu dabuji http://www.waiheke.co.nz/php/thumb/index.htm un tulit tavs kods bus gatavs =] nelielu pacietibu :D testeju vislaik nesanak bik uzgaidi
wormy Posted January 5, 2008 Author Report Posted January 5, 2008 jā es no turienes un tnx ka palīdzi ! :) vnk nemāku īsti php pārveidot par bildi un kko tamlīdzīgu, bet ar pārējo php, html un sql man problēmu nav ;)
Mikijs Posted January 5, 2008 Report Posted January 5, 2008 varbūt vārēsim kkā sadarboties? :) es arī esmu php/sql utt programmētājs :)
Recommended Posts