我正在尝试将图像上传到Amazon S3,但在此之前我正在调整图像大小.为了调整大小,我必须传递流对象并在某一点(行注释为//错误)我得到'流不支持写入'.例外.请帮忙.
public ActionResult AddPost(AddPost post)
{
Guid guid = new Guid();
AccountController ac=new AccountController();
string randomId = guid.ToString();
PutAttributesRequest putAttributesAction = new PutAttributesRequest().WithDomainName("ThisIsMyEXDomainPosts").WithItemName(randomId);
List<ReplaceableAttribute> attrib = putAttributesAction.Attribute;
System.IO.Stream stream;
System.IO.StreamReader sr = new System.IO.StreamReader(post.imageFileAddress.ToString());
sr.ReadToEnd();
stream = sr.BaseStream;
Amazon.S3.Model.PutObjectRequest putObjectRequest = new Amazon.S3.Model.PutObjectRequest();
System.Drawing.Image img = System.Drawing.Image.FromStream(stream);
System.Drawing.Image imgResized = ResizeImage(img, 640, 800);
System.IO.MemoryStream mstream = new System.IO.MemoryStream();
imgResized.Save(mstream, System.Drawing.Imaging.ImageFormat.Jpeg);
mstream.WriteTo(stream);//Error
putObjectRequest.WithBucketName("TIMEXImages");
putObjectRequest.CannedACL = Amazon.S3.Model.S3CannedACL.PublicRead;
putObjectRequest.Key = randomId + "_0.jpg";
putObjectRequest.InputStream = stream;
Amazon.S3.Model.S3Response s3Response = as3c.PutObject(putObjectRequest);
s3Response.Dispose();
//Uploadig …Run Code Online (Sandbox Code Playgroud) 我知道当大多数 WordPress 已加载但未发送标头时init会被触发,而当大多数 WordPress 已加载且标头已发送时wp_loaded会被触发。
有人可以用一个例子来解释什么可以使用这些钩子,什么不能使用这些钩子,并通过用例场景来解释和澄清它们的区别吗?
我有这个代码,当按下按钮时,它会加载一个新的UIView(来自storyboard).goPressed函数在按下按钮时触发,它调用selectImage函数.selectImage打开一个UIImagePickerController,让用户选择一张照片.用户选择照片后,didFinishPickingMediaWithInfo委托将所选图像添加到UIImageView.
在'goPressed'中,在执行selectImage之后,它应该执行一个类似于// 1的Segue.但没有任何反应.performSegueWithIdentifier似乎不起作用.如果我在调用performSegueWithIdentifier之前没有调用[self selectImage],它就可以了.这是代码:
- (IBAction)goPressed:(id)sender {
[self selectImage];
[self performSegueWithIdentifier:@"lastView" sender:currentSender]; //1
}
-(void)selectImage
{
// Create image picker controller
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
// Set source to the camera
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
// Delegate is self
imagePicker.delegate = (id)self;
// Allow editing of image ?
imagePicker.allowsEditing=NO;
// Show image picker
[self presentModalViewController:imagePicker animated:YES];
}
- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
// Access the uncropped image from info dictionary
UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
[[picker presentingViewController] …Run Code Online (Sandbox Code Playgroud) 我使用以下短代码列出woocommerce Wordpress插件中的产品类别
<?php echo do_shortcode('[product_categories number=""]'); ?>
Run Code Online (Sandbox Code Playgroud)
问题是我需要摆脱的类别缩略图.我想隐藏它,用CSS做这件事似乎是个大麻烦.无论如何我可以在没有缩略图出现的情况下列出类别吗?
Please see this UI sketch image, I have this div in sidebar (black box) on a certain site and as I scroll down or scroll up, I don't want it to hide...I want it to move itself down as I scroll down and move itself up as I scroll back up so that it never hides out. Can you recommend me some jQuery that can get this done? or something else. Please help, thanks.
使用控制器中的以下代码,我可以使用此url将类型的值传递为"rock":"http:// localhost:2414/Store/Browse?genre = rock"
public string Browse(string genre)
{
string message = HttpUtility.HtmlEncode("Store.Browse, Genre = "
+ genre);
return message;
}
Run Code Online (Sandbox Code Playgroud)
当URL为"http:// localhost:2414/Store/Browse/rock"时,我想传递相同的类型值
我怎样才能做到这一点?
我正在关注iTunes U上的斯坦福大学iOS开发课程.
在其中一个演示中(我一直试图遵循),有一个代码从a加载属性列表NSURL并将其返回为NSMutableDictionary.
-(NSMutableDictionary *) words
{
NSURL *wordsURL=[NSURL URLWithString:@"http://cs193p.stanford.edu/vocabwords.txt"];
words=[[NSMutableDictionary dictionaryWithContentsOfURL:wordsURL] retain];
return words;
}
Run Code Online (Sandbox Code Playgroud)
应用程序已成功构建,但在运行时它会出现以下错误并被卡住:

我无法弄清楚问题是什么.你能帮忙吗?
objective-c ×2
wordpress ×2
.net ×1
asp.net-mvc ×1
breakpoints ×1
c# ×1
css ×1
delegates ×1
html ×1
ios ×1
ios5 ×1
segue ×1
stream ×1
woocommerce ×1
xcode4.3 ×1