Ecshop Background Add Product album when BMP format cannot generate thumbnail image
Ecshop background Batch generation picture product album when BMP format can not generate thumbnails to find out how to solve? The effect I want to achieve is to be able to generate images in BMP format! Ecshop BMP
Share to:
------Solution--------------------
Ecshop itself does not support BMP image generation thumbnails. You have to convert to Gif/jpg/png first one of them.
------Solution--------------------
You can download a imagecreatefrombmp.php
and change your program.
------Solution--------------------
References:
Quote: References:
Ecshop itself does not support BMP image generation thumbnails. You have to convert to Gif/jpg/png first one of them.
All I want is for ecshop to support this generation diagram! What do we do?
Includes/cls_image.php is Ecshop's image processing library, you can use imagecreatefrombmp this function to expand itself
function Imagecreatefrombmp ($filename) {
Ouverture du fichier en mode binaire
if (! $f 1 = @fopen ($filename, "RB") return FALSE;
1:chargement des ent?tes fichier
$FILE = Unpack ("Vfile_type/vfile_size/vreserved/vbitmap_offset", Fread ($f 1, 14));
if ($FILE [' file_type ']! = 19778) return FALSE;
2:chargement des ent?tes BMP
$BMP = Unpack (' Vheader_size/vwidth/vheight/vplanes/vbits_per_pixel '.
'/vcompression/vsize_bitmap/vhoriz_resolution '.
'/vvert_resolution/vcolors_used/vcolors_important ', fread ($f 1, 40));
$BMP [' colors '] = POW (2, $BMP [' bits_per_pixel ']);
if ($BMP [' size_bitmap '] = = 0) $BMP [' Size_bitmap ']= $FILE [' file_size ']-$FILE [' Bitmap_offset '];
$BMP [' bytes_per_pixel '] = $BMP [' Bits_per_pixel ']/8;
$BMP [' bytes_per_pixel2 '] = ceil ($BMP [' bytes_per_pixel ']);
$BMP [' decal '] = ($BMP [' width ']* $BMP [' Bytes_per_pixel ']/4);
$BMP [' decal ']-= Floor ($BMP [' width '] * $BMP [' bytes_per_pixel ']/4);
$BMP [' decal '] = 4-(4 * $BMP [' decal ']);
if ($BMP [' decal '] = = 4) $BMP [' decal '] = 0;
3:chargement des couleurs de la palette
$PALETTE = Array ();
if ($BMP [' Colors '] < 16777216) {
$PALETTE = Unpack (' V '. $BMP [' colors '], fread ($f 1, $BMP [' colors '] * 4));
}
4:cr?ation de l ' image
$IMG = Fread ($f 1, $BMP [' Size_bitmap ']);
$VIDE = chr (0);
$res = Imagecreatetruecolor ($BMP [' width '], $BMP [' height ']);
$P = 0;
$Y = $BMP [' height ']-1;
while ($Y >= 0) {
$X = 0;
while ($X < $BMP [' width ']) {
if ($BMP [' bits_per_pixel '] = = 24)
$COLOR = @unpack ("V", substr ($IMG, $P, 3). $VIDE);
ElseIf ($BMP [' Bits_per_pixel ']== 16) {
$COLOR = Unpack ("n", substr ($IMG, $P, 2));
$COLOR [1] = $PALETTE [$COLOR [1] + 1];
}elseif ($BMP [' Bits_per_pixel ']== 8) {
$COLOR = Unpack ("n", $VIDE. substr ($IMG, $P, 1));
$COLOR [1] = $PALETTE [$COLOR [1] + 1];
}elseif ($BMP [' Bits_per_pixel ']== 4) {
$COLOR = Unpack ("n", $VIDE. substr ($IMG, Floor ($P), 1));
if (($P * 2)% 2 = = 0)
$COLOR [1] = ($COLOR [1] >> 4);
Else
$COLOR [1] = ($COLOR [1] & 0x0F);
$COLOR [1] = $PALETTE [$COLOR [1] + 1];
}elseif ($BMP [' Bits_per_pixel ']== 1) {
$COLOR = Unpack ("n", $VIDE. substr ($IMG, Floor ($P), 1));
if (($P * 8)% 8 = = 0) $COLOR [1] = $COLOR [1] >> 7;