It reads the images correctly from the database, but they are being treated as folders for some reason. So it never calls the Thumbnail controller method, it just displays the default folder thumbnail. The same thing happens when I try to select an image. It doesn't call the Image method, but instead another call to the Read method.
Any ideas?
I've attached some snippets from my code. We are currently usin gKendoUI 213.1.514.
Regards,
Jan Erik
11 Answers, 1 is accepted
We created a sample project which implements image browser with a database. Perhaps it would help you implement your requirements.
Regards,Atanas Korchev
Telerik
If a user tries to delete a folder that contains images I want to stop it with a message to the user. Do you have an example of how to accomplish this?
Thanks in advance.
Regards,
Jan Erik
You can try returning http error in this case. Check how the other action methods are implemented.
Regards,Atanas Korchev
Telerik
You are right. The folder will be remove at the client-side. Currently there is no way to prevent this behavior without modifying the source code of the editor widget.
Regards,Atanas Korchev
Telerik
I suggest you open a feature request for this in our feedback portal. It would help us track user interest and prioritize it against similar requests.
Regards,Atanas Korchev
Telerik
Is there a way to get it to insert the full path?
Regards,
Jan Erik
The editor doesn't provide any built-in feature for this behavior. You can however process the HTML server side and replace the src attribute with the absolute URL. You can use a regular expression replace to do that.
Regards,Atanas Korchev
Telerik
The controller method Thumbnail is called but the path argument is "undefined". The image is uploaded correctly and the next time I open the ImageBrowser the thumbnail is displayed correctly.
If I run 2013.2.729 it works fine.
With the latest internal build we have addressed an issue which is workaround in the sample project my colleague has send you. This workaround is causing the issue you have observed, however as you are using the latest internal build it is no longer required and you should modify the Upload action method to return an instance of ImageBrowserEntry instead of an anonymous object:
public
ActionResult Upload(
string
path, HttpPostedFileBase file)
{
if
(file !=
null
)
{
var files =
new
FilesRepository();
var parentFolder = files.GetFolderByPath(path);
if
(parentFolder !=
null
)
{
files.SaveImage(parentFolder, file);
return
Json(
new
ImageBrowserEntry
{
Name = Path.GetFileName(file.FileName)
}
,
"text/plain"
);
}
}
throw
new
HttpException(404,
"File Not Found"
);
}
Regards,
Rosen
Telerik