Background:
I working on an application on Google App Engine. Its been going really well until I hit one of their limitations in file size -- 1MB. One of the components of my application resizes images, which have been uploaded by users. The files are directly uploaded to S3 (http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1434) via POST. I was planning on using a CDN to delivered the resized images.
Question:
I was wondering if there was CDN that provided an API for resizing images through HTTP call. I found out that SimpleCDN once provided the service, but has sense removed it. I would like to tell the CDN to resize the image I am requesting from the URL.
For example,
original URL:
http://cdn.example.com/images/large_picture.jpg
resized image to 125x100:
http://cdn.example.com/images/large_picture.jpg/125/100
Does anyone know of CDN that provides a functionality like this? Or have a suggestion to get around the 1MB limit on Google App Engine (not a hack, but alternative method of code).
Looks like I have found a service that provides what I am indeed looking for. Nirvanix provides an image resize API and even has a nice library for Google App Engine to use with their API. Just thought I would share my findings.
SteadyOffload does it as well.
Related
I am writing a webcrawler that finds and saves the urls of all the images on a website. I can get these without problem. I need to upload these urls, along with a thumbnail version of them, to a server via http request, which will render the image and collect feature information to use in various AI applications.
For some urls this works no problem.
http://images.asos-media.com/products/asos-waxed-parka-raincoat-with-zip-detail/7260214-1-khaki
resizes into
http://images.asos-media.com/products/asos-waxed-parka-raincoat-with-zip-detail/7260214-1-khaki?wid=200
but for actual .jpg images this method doesn't work, like for this one:
https://cdn-images.farfetch-contents.com/11/85/29/57/11852957_8811276_480.jpg
How can I resize the jpgs via url?
Resizing the image via the URL only works if the site you're hitting is using a dynamic media service or tool in their stack. That's why ASOS will allow you to append a query with the dimensions for resize, however different DM tools will have different query parameters.
If you want to make it tolerant you're best off downloading the image, resizing it with Python and then uploading it.
I am building a webapp in Django that allows users to post links. When they post a link, I want to display a thumbnail image for the link. Right now, I simply download the first image on the linked page (using BeautifulSoup), store it in my Django model, and then serve it with the model.
I am wondering whether this is the best solution, from both a scale and security perspective? Would a better solution be to simply store a link to the original image on the original website, and then have the user's browse simply request that image from the linked website?
Would the second solution be faster and safer than downloading all the images onto my server? I am also worried about whether downloading and serving thousands of images will scale, as well as how to protect the app from images on malicious sites.
I think the best solution for this is to download the first image with BeautifulSoups (as you are currently doing) and then upload it to a CDN (like AmazonWS S3, Google Cloud Storage, etc) and save only the link to that image in your model. So the next time you view that link, you will just serve the image from your CDN.
This solution is very secure and can scale up!
I am using Google App Engine to host a website where I want users to be able to upload any video and then I want to use flowplayer to display it, which requires MP4 and webm formats to support all browsers. I have it working correctly where a user uploads a video and then I can serve it but I need to convert it into those two formats so that I everyone can view the video.
Is there any Python project I can import to do the conversion on App Engine or any resources showing how I can do it with something like Google Compute Engine? I need it to be done automatically on the server and most projects that look stable for this in python are written to by done by command line on a personal computer.
I'm not sure about Google App Engine, but you may want to look into using FFMPEG. I am currently hosting a site on heroku and have been able to use it spawning a task that will automatically grab an image from the uploaded video for display and convert the uploaded file to mp4. In order for conversion to mp4, you will need a compilation using libx264. I am no expert on this, but it may be something you want to look into if you haven't already. In my app on heroku, I am able to convert uploads to mp4, but it has definitely taken some time to figure out the right configuration and it still takes longer than I would like. However, I am also a fairly new developer and this is my first app ever created, so it might be easier for you to get working the way you want it.
I am using Google Appengine images service to serve the uploaded images in my application. The case is that some of my images are screenshots and their length is greater than 1600px which it looks to be the limitation from the service when I am calling the serving url of the image concatenating =s2000 for example. Is there a way to serve my lengthy images?
Yes, you can set =s0 to show the actual/original size image.
The docs don't really explain the =s0 functionality too well, but they are pointing out that only numbers from 0-1600 are allowed in the =sxx.
I want to cache a webpage as an image upon a user request, but I don't know where to start with this.
I'm developing on App Engine with python.
Here's a good library for capturing a webpage as a png image:
http://github.com/AdamN/python-webkit2png
One way is to use a web service such as thumbalizr since a lot of the programs for this type of thing aren't always install-able on appengine (because they use C++, etc). Other options include girafa and browsershots.
There are websites that to this for you. Google is your friend. If you build a script around them, you have what you need. As a demonstration, see http://webshots.velocitysc.com/sandbox/.
There are also downloadable programs that do it, such as the one at http://download.cnet.com/Advanced-Website-to-Image-JPG-BMP-Converter-Free/3000-2094_4-10900902.html. These are just examples; google a while and you'll find better implementations.
If you want to do it yourself, you basically need to duplicate a web browser (the HTML rendering part, anyway), which is unrealistic, or use a preexisting rendering engine like webkit as Zach suggests. If I were you, I would forget about doing it myself and use a preexisting web service, unless this is going to be the core of your application.