У меня очень неприятная проблема с динамическим сохранением изображения из текста базы данных. Этот код отлично работает в моей dev-блоке, но не на рабочем сервере.Создание образа на производственном сервере
Вот пример того, что я пытаюсь сделать:
private void SaveImage()
{
Bitmap objBmpImage = new Bitmap(300, 300);
int intWidth = 0;
int intHeight = 0;
// Create the Font object for the image text drawing.
Font objFont = new Font("Arial", 12, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel);
// Create a graphics object to measure the text's width and height.
Graphics objGraphics = Graphics.FromImage(objBmpImage);
// This is where the bitmap size is determined.
intWidth = 100;
intHeight = 100;
// Create the bmpImage again with the correct size for the text and font.
//objBmpImage = new Bitmap(objBmpImage, new Size(intWidth, intHeight));
// Add the colors to the new bitmap.
objGraphics = Graphics.FromImage(objBmpImage);
//bounding box
RectangleF rectf = new RectangleF(0, 0, 295, 295);
// Set Background color
objGraphics.Clear(Color.White);
objGraphics.SmoothingMode = SmoothingMode.AntiAlias;
objGraphics.TextRenderingHint = TextRenderingHint.AntiAlias;
objGraphics.DrawString("Test", objFont, Brushes.Black, rectf);
objGraphics.Flush();
objBmpImage.Save(@"***SERVER PATH HERE****");
Response.Write("Image saved completed");
}
есть путь сервер имеет сетевую службу написать Permissio
Спасибо, Алексей! Я проверю это. Сайт работает на общем хостинговом плане от Softsys. Поэтому у меня мало контроля над тем, какие учетные записи получают разрешения. Возможно, олицетворение - это способ, которым нужно писать изображение. Спасибо за помощь! – adminJaxon