Imageresizer.net not resizing image coming from the database - asp.net-mvc

I'm using the imageresizer plugin from http://imageresizing.net/.
The website i'm working on (an asp.net mvc5 application) contains some static images located in the /content/images folder in the root of the website.
The second part of the images is coming from the database through an MVC-controller. The static images are being resized without any problems, but the images coming from the database aren't being resized using this very same plugin.
I've created a controller called 'ImagesController' and mapped the url like 'images/'.
So the url could be like this;
http://localhost:55062/images/47cff4e6-8932-48dc-8baf-f328e89f3f83
When I make a request to this url i'm seeing my image correctly (in it's original size ofcourse), so no problems so far. So I've decided to add a with and height, and for testing purposes I also want to allow upscaling. So i'm making a request to the following url;
http://localhost:55062/images/47cff4e6-8932-48dc-8baf-f328e89f3f83?width=100&height=100&scale=both
The original size of the image behind this url is 2000 x 1334 pixels. So resizing it down to 100 x 100 pixels doesn't seem a problem to me. However, i'm seeing the image in it's original size.
A random static image on the url below is being resized without any problem;
http://localhost:55062/images/47cff4e6-8932-48dc-8baf-f328e89f3f83
What could this possibly be? I've already tried adding an extension to the url with the guid and i've also added a handler to the web.config so that .jpg urls are being ran through the .net pipeline, but unfortunately this doesn't help either. I'm quite stuck on this issue for a few hours now, so hopefully somebody can help me out on this?
The imageresizing.net debugging info is shown here: http://notepad.cc/gaxafe38

Thanks to the suggestion from TiestonT I was able to solve the problem using the SqlReader plugin.

Related

Swift, image from URL returns nil due to corrupted file type hiding as JPG

I'm experiencing a large issue right now with XCode and just MacOS/iOS in general.
For background, the website application framework I'm using is laravel and the image editor I use to crop profile images is called image intervention, a quite popular extension for laravel.
To skip straight into it- I'm creating a basic companion application for my website, which, like pretty much all other websites, stores images on the server. This can be reached with the www.mywebsite.com/storage/ base URL, with the addition of the file name on the end. There is a bit more to it, but none of that is the issue.
I've been using it many times already, as there are multiple folders for different image relationships. One folder, lets just call it postimages (so link is now www.mywebsite.com/storage/postimages), returns images with no issue, and I've been using it multiple times up to this point. The code I use in swift to return the different images is as follows (in my specific views)
func getPic(urlLink: String)-> Image? {
let baseURL = "https://www.mywebsite.com/storage"
let url = URL(string: baseURL + urlLink)
let data = try? Data(contentsOf: url!)
let image = UIImage(data: data!)
let image2 = Image(uiImage: (image ?? nil)!)
return image2
}
So this might be badly written or whatnot, but that's definitely not the source of any issue, so approach it as you wish. Anyways, again, I've used this function in multiple views to retrieve multiple different images from different folders on the storage endpoint.
The issue just came up when trying to retrieve images from a different endpoint, specifically my /profileimages endpoint. Up until now, as I've stated, this function has never had an issue. Now, when I try to use it to get profile images, it crashes the app with the error
"Unexpectedly found nil while unwrapping an Optional value"
around the line where it is let data = try? Data(contentsOf: url!).
Now this gave me much grief because the URL (when hovered) showed the
correct URL link, and when I entered them into the browser it returned
the image in question. So why is the image somehow returning nil? I
don't know.
To add to the mystery, I've been trying to work around the issue, by downloading the default profile image and just changing the function to return the default image if there was no data at the URL (even though there should be, 100% of the time).
When I tried to download the default profile picture, by using the https://www.mywebsite.com/storage/profileimages/blank.jpg link, I tried adding it to XCode as an asset and it had a big red exclamation point over it. Trying to open it with preview gave me the error "The file "blank.jpg" could not be opened. It may be damaged or use a file format the Preview doesn't recognize." This is surprising because on my Windows computer, trying to do the same thing has no issue at all.
My suspicion is that because I used the extension to crop and fit the profile images to a square size, somehow in that process of saving it, image intervention corrupted the file, and while Windows recognizes it as JPEG, Swift does not.
I ask any of those who are more experienced with image manipulation please help me understand this, obviously displaying user's profile pictures is vital to creation of a website mobile companion application, and right now I can't do anything besides basic text tabviews without this working as intended.
I'm going to post my own answer as I've been able to solve the mystery. The first problem was the default image was, indeed, corrupted. I made a new one with GIMP and have been using that one instead. Why Windows could still open it and MacOS couldn't is beyond me, perhaps they have stricter guidelines for what constitutes a JPG file and therefore the file sneaks past Windows but not Mac, whatever the issue, obviously replacing the file solved my problem. The second issue was returning nil, which I found out was because I wasn't percent encoding the URL link. Some users post pictures with spaces in it, so I needed to add percent encoding in order for it to work (for some reason). Both of those solutions combined has removed the entire problem I was facing and I no longer have pictures returning nil.
I am facing same issue but I found solution, The image is in webp format, which is specially designed by google for chrome. iOS wont support webp.

Cropping Image With ImageProcessor not working on server

I use this plugin for cropping image in my asp.net mvc 5 application. When I launch application in localhost every thing are right and I can crop image successfully. But I cant crop images on server. I don't get any error and image saved in original size. I also uploaded config folder at the root of website and my web config has default setting according to ImageProcessor.Web configuration.
I don't know what the problem is and what should I check.
Can anyone help me what's the problem?
I found that CloudFlare prevent Imageprocessor work as well as localhost.
When I disable cloudflare every thing was OK.

SimpleCmsImage.save will not save a thumbnail image

I have a Ruby on Rails web application that uses the Simple CMS plug-in to upload images to the app.
I've used this before. In fact, my current web application is a clone of an original application that works perfectly.
With the new app, the image itself uploads okay, but - unlike the original app - it does not automatically generate a thumbnail image.
I've isolated this down to the point where SimpleCmsImage.save is called. In the original app, this automatically does two insertions into the simple_cms_image table - one for the image itself; and one for the automatically-generated thumbnail image.
In the new app, there is only one insertion for the image, none for the thumbnail.
Does anyone have any suggestions? I'm at my wit's end to figure this one out?
Thanks in advance,
Tim

forge.topbar.setTitleImage(URL,success,error); dynamic image .. fileCache?

I have been told this is possible to do but cannot get this to work.
Basically I am trying to cache and image using forge.file.cacheURL()
Now I can get the file just fine and display it in the page by creating a new Image object but what I want to do is use this cached image to change the image in the topbar.
When ever I try to do it I get an error saying "file not found" and after reading the docs a little more it seems that trigger may have "src/" coded into the class because if I put just "image/logo.png" the logo.png will show up in the header because its part of the app package.
I guess the question is.. Is my assumption correct?
Thanks!
The native UI elements (topbar/tabbar) load images directly from your apps package, not through a URL in the same ways images are shown in the webview.
What this means is that currently you can only use images included in your app in the topbar/tabbar modules.
in case anyone is interested in this, the ability was added a while ago to the API so you can now use a cached image or filesaveURL feature of forge to change the header image dynamically.

Image in rails asset pipeline loading indefinitely, but still appearing

Okay so basically, I have a file in my asset pipeline (http://myapp.dev/assets/avatars/default-avatar.jpg). When I visit the URL, the image loads, but continues to act as though it's transferring data (the chrome spinner is spinning). If I access the same file in production instead of development, it works just fine. In addition, no other files have this issue, it's only that ONE jpeg in that ONE folder.
I have no clue what this could be. Can anyone help?
EDIT: This is what the network activity looks like
I had the same issue (the image would show up but continue to load for a long period of time, then the transfer would ultimately fail and the image would appear broken).
Saving the image again in Photoshop resolved it for me, as you mentioned in your comment above. Must have been something wrong with the image encoding.

Resources