Hello,

I want to convert a 1024 x 786 wallpaper into thumbnail in PHP

Wots the code for it?


Thanx in advance

Try something like this:

$size = getimagesize ("path_to_original_image");
        $mini = imagecreatetruecolor(100,100);
    	$orig = imagecreatefromjpeg ("path_to_original_image");
    	imagecopyresampled ($mini, $orig, 0, 0, 0, 0, 100, 100, $size[0], $size[1]);
    	imagejpeg ($mini, "path_to_thumbnail/thumbnail.jpg", 100);

This creates a 100x100 Pixel Thumbnail. Make sure, depending on your version of PHP, that the GD library is installed.


Michael

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.