Προς το περιεχόμενο

exw ftiaksei ena image gallery se php me mysql


theolam

Προτεινόμενες αναρτήσεις

Δημοσ.

Υπάρχουν και βιβλιοθήκες, όπως η ΙmageMagick ή το NetPBM, οι οποίες κάνουν τέτοιες δουλειές (τουλάχιστον τα gallery scripts που κυκλοφορούν ευρέως ξέρω ότι τις χρησιμοποιούν αρκετά).

 

Πέρα όμως από τα ονόματά τους, δε γνωρίζω και πολλά. Θα μπορούσες να δεις πως τις εκμεταλλεύονται άλλα scripts ή σε τελική ανάλυση να χρησιμοποιήσεις και εσύ ένα έτοιμο script για αυτήν τη δουλειά.

Δημοσ.

-> ImageJpeg($dst, null, 100);

allakte tin timh tou 100 gia tin poiothta...

kai ->

$max_width = 110;

 

$max_height = 80;

--------------------------------------------------------

 

<?php

 

if (!$max_width)

$max_width = 110;

if (!$max_height)

$max_height = 80;

 

$size = GetImageSize($image);

$width = $size[0];

$height = $size[1];

 

$x_ratio = $max_width / $width;

$y_ratio = $max_height / $height;

 

if ( ($width <= $max_width) && ($height <= $max_height) ) {

$tn_width = $width;

$tn_height = $height;

}

else if (($x_ratio * $height) < $max_height) {

$tn_height = ceil($x_ratio * $height);

$tn_width = $max_width;

}

else {

$tn_width = ceil($y_ratio * $width);

$tn_height = $max_height;

}

 

$src = ImageCreateFromJpeg($image);

$dst = imagecreatetruecolor($tn_width,$tn_height);

ImageCopyResized($dst, $src, 0, 0, 0, 0,$tn_width,$tn_height,$width,$height);

header("Content-type: image/jpeg");

ImageJpeg($dst, null, 100);

ImageDestroy($src);

ImageDestroy($dst);

 

?>

Αρχειοθετημένο

Αυτό το θέμα έχει αρχειοθετηθεί και είναι κλειστό για περαιτέρω απαντήσεις.

  • Δημιουργία νέου...