Im working on a template for a website that has already more than 50,000 articles and images assigned to every article. Before now the article image was visible only inside every article, but now I would like to use thumbnails. I don't have access to modify the upload image form, so the solution should be something like virtual thumbs created from the original images... What will be the best approach in this case?

有帮助吗?

解决方案

Using Mr. Thumb like I advised a simple script to get it working would be

<?php 

include './mrthumb.class.php'; 

// The image you are resizing. Can be a local path as well. 
$image = $_GET['i'];

$quality = 100; // percent 

// In this example we are resizing the image in proportionate sizes. 
// Below we are specifying the MAX width and height. 
$width = 100; // Pixels 
$height = 130; // Pixels 

// Start Mr. Thumb v1.0 
$mrthumb = new MrThumb(); 

// Render the image 
$mrthumb->render( $image ); 

// Resize the image proportionately 
// $mrthumb->constrain( $width, $height ); 
$mrthumb->proportion( $width, $height ); 

// Finally, output the image to the browser! 
// Optionally we can save the image to a destination 
// $mrthumb->saveto( $destination, $filename, $quality ); 
$mrthumb->output( $quality ); 

// Clean up after you are done! ;) 
$mrthumb->clear_cache(); 

?>

Then save that to your web server along with the mrthumb class and call a thumbnail in your webpage like

<img src="./mrthumb.php?i=images/myimage.jpg" alt="My Image" />
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top