Chcę zmienić tworzenie miniatur tak, aby wszystkie miały jednakową wysokosć, a nie jak jest domyślnie szerokość.
Próbowałam pozamieniać nazwy w pliku FotoJobs na zasadzie ThumbX <-> ThumbY ScaleX<->ScaleY Ale nic to nie dało.
Jak tylko zmieniłam w niektórych przypadkach w funkcji copyAndCreateThumb działało, ale skrypt ignorował ustawienia z general.php i tworzył miniatury domyślnie na 100px wysokie a ja potrzebuje do wyboru miec 200 lub 350px.
To jest takie robienie na sztywno. W tej chwili mam na sztywno w pliku odpowiadającym za generowanie contentu, wysokość dla plików wyświetlanych z listy.
Znalazłam na forum generowanie kwadratów,ale też mi to wiele nie pomaga.
na chwilę obecną mam 2 pliki pages.tpl wiec jakos moge to rozdzielic. jednak jakby ktos dal radę rozwiazać ten problem byłoby idealnie.
tylko że tam jest opisana solucja dla kwadratów, a ja chce dalej prostokaty, ale żeby ustawiona wartosć z panelu 200 czy 150 odnosiła sie nie do szerokosci tylko wysokosci.
public static function getInstance( ){ if( !isset( self::$oInstance ) ){ self::$oInstance = new FotoJobs( ); } return self::$oInstance; } // end function getInstance
/** * Constuctor * @return void * @param int $iThumbSize */ private function __construct( $iThumbSize = 100 ){ $this->iThumbX = $iThumbSize; } // end function __construct
/** * Sets thumb size * @return void * @param int $iThumbSize */ public function setThumbSize( $iThumbSize = 100 ){ $this->iThumbX = $iThumbSize; } // end function setThumbSize
/** * Sets thumb quality * @return void * @param int $iThumbQuality */ public function setThumbQuality( $iThumbQuality = 80 ){ $this->iQuality = $iThumbQuality; } // end function setThumbQuality
/** * Sets name addition for thumb * @return void * @param int $iThumbAdd */ public function setThumbAdd( $iThumbAdd = '_m' ){ $this->iThumbAdd = $iThumbAdd; } // end function setThumbAdd
/** * Sets name addition for custom thumb * @return void * @param int $iThumbAdd */ public function setCustomThumbAdd( $sThumbAdd = null ){ $this->sCustomThumbAdd = $sThumbAdd; } // end function setCustomThumbAdd
/** * Sets max dimension of picture (when bigger thumb wont be create) * @return void * @param int $iMaxForThumbSize */ public function setMaxForThumbSize( $iMaxForThumbSize = 2000 ){ $this->iMaxForThumbSize = $iMaxForThumbSize; } // end function setMaxForThumbSize
/** * Sets ratio of image * @return void * @param int $fRatio */ public function setRatio( $fRatio = 0.80 ){ $this->fRatio = $fRatio; } // end function setRatio
/** * Upload and copy of files and create thumbs from them * @return array * @param string $sDestDir - destination directory * @param mixed $mImgSrc - when upload = $_FILES or when copy = file path * @param string $sImgOutput - suggested output file name * @param mixed $sOption - upload or copy */ public function copyAndCreateThumb( $sDestDir, $mImgSrc, $sImgOutput, $sOption = null ){
// remember thumb size $iOldSize = $this->iThumbX;
return $aNewFiles; } // end function copyAndCreateThumb
/** * Clears propeties of object (set to default) * @return void */ public function clearAll( ){ $this->iThumbX = 100; $this->iThumbY = 100; } // end function clearAll
if( $sOption == 'width' || $sOption == 'height' ) return $aImgSize[$sOption]; else return $aImgSize; } // end function throwImgSize
/** * Returns image width in px * @return int * @param string $imgSrc */ public function throwImgWidth( $imgSrc ){ return $this->throwImgSize( $imgSrc, 'width' ); } // end function throwImgWidth
/** * Returns image height in px * @return int * @param string $imgSrc */ public function throwImgHeight( $imgSrc ){ return $this->throwImgSize( $imgSrc, 'height' ); } // end function throwImgHeight
/** * Creates new custom size thumb * @return string * @param string $sImgSource * @param string $sImgDestDir * @param int $iSize * @param string $sImgOutput * @param bool $bOverwrite */ public function createCustomThumb( $sImgSource, $sImgDestDir, $iSize = null, $sImgOutput = false, $bOverwrite = null ){
/** * Function make photo thumbs * @return int * @param string $sImgSource - source file, from it thumb is created * @param string $sImgDestDir - destination directory for thumb * @param string $sImgOutput - picture name after change (default old name with _m addition) * @param mixed $sOption - b/d */ public function createThumb( $sImgSource, $sImgDestDir, $sImgOutput = false, $iQuality = null, $sOption = null ) {
ale mimo to, kwadraty przyjmują formę tylko 150 x 100, przy wiekszych, zdjecie jest skalowane do tego rozmiaru. Mam ten sam problem co cavvy, chciałabym żeby wszystkie miniatury miały jednakową wysokosć, a nie jak jest domyślnie szerokość. Na dzień dzisiejszy mam kwadraty o wielkości 150 x 100. Przy mniejszych nie ma problemu, układają się "nierówno", ale układają. Większe niz 150 x 100 jednak nie będą... system generuje tylko kwadraty.
Najprościej tak: w pliku image-jobs.php lub FotoJobs.php (w starszych wersjach), w funkcji createThumb zamienić: $iScaleX=$this->iThumbX / ($iImgCreateX); na: $iScaleY=$this->iThumbY/($iImgCreateY); następnie zamienić: $this->iThumbY=$iImgCreateY * $iScaleX; na: $this->iThumbX=$iImgCreateX*$iScaleY; i wykomentować lub wyrzucić to: $iRatio=$this->iThumbX / $this->iThumbY; if($iRatio < $this->fRatio) { $this->iThumbY=$this->iThumbX; $iScaleY=$this->iThumbY / ($iImgCreateY); $this->iThumbX=$iImgCreateX * $iScaleY; } I to wszystko. Od tej chwili miniaturki nowo wgrywanych zdjęć będą miały jednakową wysokość a nie szerokość.
Dziwna sprawa... zdjęcia zaczely mi się wyswietlac (po kliknięciu na miniaturkę) w rozmiarze ok. 100px jeden bok. Miniaturki wyświetlają się w jednakowym rozmiarze tylko przy ustawieniach 100.
boboo, albo kod jest przekręcony (to miniaturki + zdjecia w pelnym rozmiarze) zamieniły się miejscami... albo ja coś pokręciłam, co jest mało prawdopodobne. Czy mógłbyś sprawdzić poprawność tego kodu?
Jeszcze drobnostka: w tyma samym pliku w funkcji setThumbSize należy zamienić X na Y oraz: $iOldSize = $this->iThumbX; zamienić na $iOldSize = $this->iThumbY;
public static function getInstance( ){ if( !isset( self::$oInstance ) ){ self::$oInstance = new FotoJobs( ); } return self::$oInstance; } // end function getInstance
/** * Constuctor * @return void * @param int $iThumbSize */ private function __construct( $iThumbSize = 100 ){ $this->iThumbX = $iThumbSize; } // end function __construct
/** * Sets thumb size * @return void * @param int $iThumbSize */ public function setThumbSize( $iThumbSize = 100 ){ $this->iThumbX = $iThumbSize; } // end function setThumbSize
/** * Sets thumb quality * @return void * @param int $iThumbQuality */ public function setThumbQuality( $iThumbQuality = 80 ){ $this->iQuality = $iThumbQuality; } // end function setThumbQuality
/** * Sets name addition for thumb * @return void * @param int $iThumbAdd */ public function setThumbAdd( $iThumbAdd = '_m' ){ $this->iThumbAdd = $iThumbAdd; } // end function setThumbAdd
/** * Sets name addition for custom thumb * @return void * @param int $iThumbAdd */ public function setCustomThumbAdd( $sThumbAdd = null ){ $this->sCustomThumbAdd = $sThumbAdd; } // end function setCustomThumbAdd
/** * Sets max dimension of picture (when bigger thumb wont be create) * @return void * @param int $iMaxForThumbSize */ public function setMaxForThumbSize( $iMaxForThumbSize = 2000 ){ $this->iMaxForThumbSize = $iMaxForThumbSize; } // end function setMaxForThumbSize
/** * Sets ratio of image * @return void * @param int $fRatio */ public function setRatio( $fRatio = 0.80 ){ $this->fRatio = $fRatio; } // end function setRatio
/** * Upload and copy of files and create thumbs from them * @return array * @param string $sDestDir - destination directory * @param mixed $mImgSrc - when upload = $_FILES or when copy = file path * @param string $sImgOutput - suggested output file name * @param mixed $sOption - upload or copy */ public function copyAndCreateThumb( $sDestDir, $mImgSrc, $sImgOutput, $sOption = null ){
// remember thumb size $iOldSize = $this->iThumbX;
return $aNewFiles; } // end function copyAndCreateThumb
/** * Clears propeties of object (set to default) * @return void */ public function clearAll( ){ $this->iThumbX = 100; $this->iThumbY = 100; } // end function clearAll
if( $sOption == 'width' || $sOption == 'height' ) return $aImgSize[$sOption]; else return $aImgSize; } // end function throwImgSize
/** * Returns image width in px * @return int * @param string $imgSrc */ public function throwImgWidth( $imgSrc ){ return $this->throwImgSize( $imgSrc, 'width' ); } // end function throwImgWidth
/** * Returns image height in px * @return int * @param string $imgSrc */ public function throwImgHeight( $imgSrc ){ return $this->throwImgSize( $imgSrc, 'height' ); } // end function throwImgHeight
/** * Creates new custom size thumb * @return string * @param string $sImgSource * @param string $sImgDestDir * @param int $iSize * @param string $sImgOutput * @param bool $bOverwrite */ public function createCustomThumb( $sImgSource, $sImgDestDir, $iSize = null, $sImgOutput = false, $bOverwrite = null ){
/** * Function make photo thumbs * @return int * @param string $sImgSource - source file, from it thumb is created * @param string $sImgDestDir - destination directory for thumb * @param string $sImgOutput - picture name after change (default old name with _m addition) * @param mixed $sOption - b/d */ public function createThumb( $sImgSource, $sImgDestDir, $sImgOutput = false, $iQuality = null, $sOption = null ) {
public static function getInstance( ){ if( !isset( self::$oInstance ) ){ self::$oInstance = new FotoJobs( ); } return self::$oInstance; } // end function getInstance
/** * Constuctor * @return void * @param int $iThumbSize */ private function __construct( $iThumbSize = 100 ){ $this->iThumbX = $iThumbSize; } // end function __construct
/** * Sets thumb size * @return void * @param int $iThumbSize */ public function setThumbSize( $iThumbSize = 100 ){ $this->iThumbX = $iThumbSize; } // end function setThumbSize
/** * Sets thumb quality * @return void * @param int $iThumbQuality */ public function setThumbQuality( $iThumbQuality = 80 ){ $this->iQuality = $iThumbQuality; } // end function setThumbQuality
/** * Sets name addition for thumb * @return void * @param int $iThumbAdd */ public function setThumbAdd( $iThumbAdd = '_m' ){ $this->iThumbAdd = $iThumbAdd; } // end function setThumbAdd
/** * Sets name addition for custom thumb * @return void * @param int $iThumbAdd */ public function setCustomThumbAdd( $sThumbAdd = null ){ $this->sCustomThumbAdd = $sThumbAdd; } // end function setCustomThumbAdd
/** * Sets max dimension of picture (when bigger thumb wont be create) * @return void * @param int $iMaxForThumbSize */ public function setMaxForThumbSize( $iMaxForThumbSize = 2000 ){ $this->iMaxForThumbSize = $iMaxForThumbSize; } // end function setMaxForThumbSize
/** * Sets ratio of image * @return void * @param int $fRatio */ public function setRatio( $fRatio = 0.80 ){ $this->fRatio = $fRatio; } // end function setRatio
/** * Upload and copy of files and create thumbs from them * @return array * @param string $sDestDir - destination directory * @param mixed $mImgSrc - when upload = $_FILES or when copy = file path * @param string $sImgOutput - suggested output file name * @param mixed $sOption - upload or copy */ public function copyAndCreateThumb( $sDestDir, $mImgSrc, $sImgOutput, $sOption = null ){
// remember thumb size $iOldSize = $this->iThumbY;
return $aNewFiles; } // end function copyAndCreateThumb
/** * Clears propeties of object (set to default) * @return void */ public function clearAll( ){ $this->iThumbX = 100; $this->iThumbY = 100; } // end function clearAll
if( $sOption == 'width' || $sOption == 'height' ) return $aImgSize[$sOption]; else return $aImgSize; } // end function throwImgSize
/** * Returns image width in px * @return int * @param string $imgSrc */ public function throwImgWidth( $imgSrc ){ return $this->throwImgSize( $imgSrc, 'width' ); } // end function throwImgWidth
/** * Returns image height in px * @return int * @param string $imgSrc */ public function throwImgHeight( $imgSrc ){ return $this->throwImgSize( $imgSrc, 'height' ); } // end function throwImgHeight
/** * Creates new custom size thumb * @return string * @param string $sImgSource * @param string $sImgDestDir * @param int $iSize * @param string $sImgOutput * @param bool $bOverwrite */ public function createCustomThumb( $sImgSource, $sImgDestDir, $iSize = null, $sImgOutput = false, $bOverwrite = null ){
/** * Function make photo thumbs * @return int * @param string $sImgSource - source file, from it thumb is created * @param string $sImgDestDir - destination directory for thumb * @param string $sImgOutput - picture name after change (default old name with _m addition) * @param mixed $sOption - b/d */ public function createThumb( $sImgSource, $sImgDestDir, $sImgOutput = false, $iQuality = null, $sOption = null ) {
Chyba jednak będę "cieła" do rownych wielkosci wszystkie zdjęcia... nawet jeśli będą to portrety... Wczesniej tworzylam osobne zakladki do zdjęć portretów, ale szkoda miejsca..