小编Dan*_*l P的帖子

"无法修改Controls集合,因为控件包含代码块"

我正在尝试创建一个简单的用户控件,它是一个滑块.当我向用户控件添加AjaxToolkit SliderExtender时,我得到了这个(*&$#()@#error:

Server Error in '/' Application. The Controls collection cannot be modified because the control contains code blocks (i.e. `<% ... %>`). Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. `<% ... %>`).

Source Error:

An unhandled exception was generated …
Run Code Online (Sandbox Code Playgroud)

c# asp.net user-controls

365
推荐指数
7
解决办法
39万
查看次数

使用PHP中的GD库将位图文件转换为JPEG

我一直试图找到一种方法,使用PHP中的GD库将位图文件转换为JPEG.

我尝试了很多实现,但似乎没有任何工作.我曾试图告诉我的客户他们不应该使用Bitmap文件,但他坚持并且坦率地不完全理解计算机将它们自己转换为JPG.

我不能在这台服务器上使用ImageMagick,我需要一个纯粹的GD解决方案.提前感谢您提供任何帮助.

编辑:

正在使用的位图图像是16位,这是问题发生的地方.

我有这个功能,我有工作....有点:

function ImageCreateFromBMP($filename) {
    if (! $f1 = fopen($filename,"rb")) return FALSE;

    $FILE = unpack("vfile_type/Vfile_size/Vreserved/Vbitmap_offset", fread($f1,14));
    if ($FILE['file_type'] != 19778) return FALSE;

    $BMP = unpack('Vheader_size/Vwidth/Vheight/vplanes/vbits_per_pixel'.
        '/Vcompression/Vsize_bitmap/Vhoriz_resolution'.
        '/Vvert_resolution/Vcolors_used/Vcolors_important', fread($f1,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;

    $PALETTE = array();
    if ($BMP['colors'] < 16777216 && $BMP['colors'] != 65536) {
        $PALETTE = …
Run Code Online (Sandbox Code Playgroud)

php gd jpeg bitmap

6
推荐指数
1
解决办法
2万
查看次数

标签 统计

asp.net ×1

bitmap ×1

c# ×1

gd ×1

jpeg ×1

php ×1

user-controls ×1