I am planning to host images via Google app engine blobstore API.
It looks to be very promising on performance and cheap.
Also I would be able to map to my custom domain.
But few things that I wish to know about.
1.) Is serving images via blobstore a good idea in regards to SEO of my application?
As all my images are going to dynamic, does google index dynamic images with my custom domain url.
2.)And image serving is going to cost outgoing bandwidth which seems too be cheap but still is there any other alternative to cut off outgoing bandwidth cost?
3.) And please suggest if there is any other alternative that is better that GAE and can serve my requirements.
1.)Is serving images via blobstore a good idea in regards to SEO of my application? As all my images are going to dynamic, does google index dynamic images with my custom domain url.
Don't put the images in database. Instead upload the images and put the link in database. Instagram uses s3 for its images, so you don't have to worry about performance. If you store the images as files and provide a link, search engines can index them well. Just make sure you use relevant names for the images. For example, for this image use http://example.com/data/image-store/owl-be-your-valentine
3.)And please suggest if there is any other alternative that is better that GAE and can serve my requirements.
I have not used GAE. If you are asking for an alternative. I would suggest you aws s3.
2.)And image serving is going to cost outgoing bandwidth which seems too be cheap but still is there any other alternative to cut off outgoing bandwidth cost?
s3 is cheap, very cheap. http://www.codinghorror.com/blog/2007/03/using-amazon-s3-as-an-image-hosting-service.html
It's depend on daily usage.
Google App Engine has a daily free quota(1GB outgoing traffic).
If you daily taffic around 1-5GB,Google App Engine is the cheapest way.
Whn using Java to host images with GAE, you should use the getServingUrl. You pass it a blob key, along with optional resize and crop options, and it gives you back a URL.
Related
I'm using AWS S3 for storage my images and accessing them by Cloudfront. Here is mine access url formate. For example:
http://mybucket.s3.amazonaws.com/qGdyRHeptWqR5sl.jpg
I want to use thumbnail for this image. Generating thumbnails at upload time is not modern approach especially when you are required a lot of different size images. It's not good in maintenance point of view. A little change in design required to regenerate all of thumbnails again.
Is there any possibility for thumbnail image to be generated on the fly by just requesting a URL something like below:
http://mybucket.s3.amazonaws.com/thumb/200/150/qGdyRHeptWqR5sl.jpg
OR
http://mybucket.s3.amazonaws.com/qGdyRHeptWqR5sl.jpg?size=200x200
OR
http://mybucket.s3.amazonaws.com/qGdyRHeptWqR5sl.jpg?width=200&height=200
I've tried all the above url but no success. DO i need to use some image resizing plugin to do so? Do i need to request image from cloudefront & resize it then reupload it on S3?
I'm using Java as programming language please recommend me some plugin or better approach in this case.
One of possible solutions related to ngx_http_image_filter_module plugin for Nginx. You can install Nginx and configure it to resize images from S3 by request.
Here is article which describe how to do it.
I am building an application where audio data is uploaded to my GAE server, processed, and displayed as a response to an HTTP GET request.
Part of the data I wish to display is in the format of a graph. What I am having a hard time understanding is how to create my response in such a way that I can include graphs.
From what I understand, one approach might be to create the graph using this API:
http://googleappsdeveloper.blogspot.ca/2011/09/visualize-your-data-charts-in-google.html
And then store it as a blob in my datastore. I can then create a JSP to serve the blob as an image? Not sure if I am understanding this correctly. Specifically, I'm not sure about being able to access all of this functionality from GAE, and if I'm doing this in a convoluted way.
I am quite new to GAE and web programming in general, so I greatly appreciate feedback and suggestions on how to do this in the simplest/quickest way. I wouldn't mind links to relevant resources as well.
you have mainly two ways to go:
1) Send in your response only data and let your front end (your website or app) parse them and put them in graph form.
You can write in your response the data to show, and it is quite suggested to give them a structure (so as your front-end can easily interpret and validate the data). Common formats are JSON and XML (they basically can give a custom hierarchical structure to your data,for example you can organize the graph data in columns form)
The way to build a graph depends on the technology you use in your front-end and you can either use a third part library or build your own
2) Create graphs in your web application, store them and allow users to get them via HTTP. Once you have found a way to build a graph image from data you need to store it. GAE gives to you two storage systems, the Blobstore and the Google Cloud Storage.
I think You can save files in the Blobstore only by direct upload via HTTP therefore if you're saving image directly in your GAE web app there's no easy way to use it (you should open an HTTP connection).
The Google cloud storage instead can be accessed by using the dedicated libraries (https://developers.google.com/appengine/docs/java/googlecloudstorageclient/getstarted) that you need to download and add to your project during the developing phase (and activate them) there are tutorials for this (https://developers.google.com/appengine/docs/java/googlecloudstorageclient/).
In order to serve images you can bypass the middle code that should read the image from the GCS and serve it as a response by using the Images service. Once generated a so called "serving URL" associated to a given image, the images service permits to directly access to the image via HTTP (https://developers.google.com/appengine/docs/java/images/).
Finally the first option is interesting because (obviously if you can) it's simpler and lighter for the server side (the one you pay) and you can anyway cache the images to avoid useless computation, the second is maybe more correct in a certain point of view but it is more complex.
I'm porting an old Java project to GAE. It has some servlets, which generate html pages with static images in them. In the original project these images are stored on the filesystem next to the servlets.
I'm trying to use GCS in the first place, I've uploaded my files and gave permissions on public read. In this case I can reach the files with their public link, I can embed these links into the HTML output. But I have a feeling that this isn't the right solution. The load time seems quite slow, like the images don't "travel internally", and I have to provide permission for every single image.
So my question is, how to get an "internal" URL for a file located on GCS in your GAE application?
I've found some Java examples, but in my case I don't think I need the image object in the source, I just need an URL to pass it on to the HTML source.
As far as I know I could just simple deploy the images with the source as resources, but there are quite many of them.
If there are other soultions, like Datastore, I'm open for that too, but I thought GCS would be the easiest.
Google Cloud Storage is as fast an option for loading images as any other. A browser reads a link and asks the server (in this case GCS) to deliver an image. There is no "internal" URL that can work faster - the speed reflects the bandwidth/distance between GCS and the browser which asked for an image.
You can speed it up by using a CDN, where your image is stored on local servers throughout the world. It only makes sense if you serve content to a very large number of users, and it is a critical part of how fast a page loads.
Another way to speed up page load time is to use image sprites instead of images. This way you cut the number of requests from a browser to a server (i.e. GCS). If you images do not change frequently, and most pages need the same "collection" of images (i.e. not shown dynamically), this is a very good solution.
My java app generates some .png image which i want to store to any cloud storage through java API. I dont want any paid service if possible in free. Not getting a good answer for last 4 hours. Any suggestion?
Google Cloud Storage doesn't have a free tier, although for only a handful of PNG images you will likely be spending less than $1 per month.
Google Drive, however, is free for the first 15 GB or so (it's shared with your GMail account, your Google+ photos, etc). Google Drive also provides a Java API: https://developers.google.com/drive/quickstart-java
Dropbox and S3 also both have APIs and various quantities/time of free storage. If you're just looking to host images, and you're not trying to make money, and you don't need to host that many, you could look into image-specific services. Imgur.com, for example, provides an API.
Dropbox and Google Drive could meet your needs. You can download/upload files pragmatically to Dropbox and also to Google Drive. They have API to do it.
However, if you are really looking for really complete service where you can scale up your data storage until you want, you really want to take a look at Amazon S3. In fact, as far as I know, Dropbox works on the top of Amazon S3 to provide their services.
If you would like to have an idea about how to upload/download a file to Amazon S3, you can take a look to this application example. If you want the same thing on Dropbox or Google Drive, there are a lot of examples on Internet. However, on these two providers you need a token to upload files, what I don't like. I prefer the way in which it works for Amazon S3 (just for programming purposes - GUI is better on GD or Dropbox).
Amazon S3 is not totally free, but it is really, really cheap.
Be aware of the network latency between your app and your File storage provider if you don't use the same physical infrastructure.
I am using facebook login on my site. When I test locally I need to use local.mysite.com, so facebook thinks the request is coming from my site. This works great except when I upload images to blobstore. When uploading images app engine always switches to localhost:888. This makes the browser think cross site scripting is happening and prevents my uploads. How can I force app engine to use local.mysite.com instead of localhost:888
This is the error I am getting:
XMLHttpRequest cannot load http://localhost:8888/_ah/upload/agpidWJwcm9qZWN0chsLEhVfX0Jsb2JVcGxvYWRTZXNzaW9uX18YBQw. Origin http://local.mysite.com:8888 is not allowed by Access-Control-Allow-Origin.
I'm not sure you can actually change that URL.
What you can do though is to use the localhost:8888 for your local tests and create another Facebook application that points to localhost. Afterwards there are two approaches that you can do in order be able to use these two (or possibly even more in the future) Facebook applications in your app.
You can decided based on the requested URL which key to use
Store all the keys in somekind configuration Datatstore that only admins can change them
With the first approach you will have to store somehow all the keys in your code or even worse in the datastore and then decided based on the URL which one to use. This approach is not good and it doesn't scale very well. The second approach is preferable since you don't have to store your keys in the code, it is more secure and it scales much better since you don't need to know up front how many different Facebook applications you have.
You can read the Nick Johnson's answer on how to solve that in Python, but the idea is Java so it shouldn't be that hard.