[google-appengine] store images in datastore using php
Hello, Is there some example code in PHP which will enable me to store / retrieve images (jpg, png files) to / from the google datastore ? I found example code for python(link: https://developers.google.com/appengine/articles/python/serving_dynamic_images) and java (link: https://developers.google.com/appengine/articles/java/serving_dynamic_images) but not for PHP. If someone has a working PHP code for storing / retrieving images to / from datastore , it would be great if you could share the code. Thanks and Regards, Rohith -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscr...@googlegroups.com. To post to this group, send email to google-appengine@googlegroups.com. Visit this group at http://groups.google.com/group/google-appengine. For more options, visit https://groups.google.com/d/optout.
Re: [google-appengine] store images in datastore using php
Well PHP runtime doesnt actully have direct access to the DataStore right now :) Have to proxy it though say the Cloud Datastore. https://developers.google.com/datastore/ Which is then just an exercise in accessing a remote API. https://gae-php-tips.appspot.com/2013/12/23/getting-started-with-the-cloud-datastore-on-php-app-engine/ But frankly storing images in the datastore, is probably not the best practice. Using Google Cloud Storage would be better. https://developers.google.com/appengine/docs/php/googlestorage/ On 16 August 2014 10:26, Rohith D Vallam wrote: > Hello, > > Is there some example code in PHP which will enable me to store / > retrieve images (jpg, png files) to / from the google datastore ? I found > example code for python(link: > https://developers.google.com/appengine/articles/python/serving_dynamic_images > ) and java (link: > https://developers.google.com/appengine/articles/java/serving_dynamic_images) > but > not for PHP. If someone has a working PHP code for storing / retrieving > images to / from datastore , it would be great if you could share the code. > > Thanks and Regards, > Rohith > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to google-appengine+unsubscr...@googlegroups.com. > To post to this group, send email to google-appengine@googlegroups.com. > Visit this group at http://groups.google.com/group/google-appengine. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscr...@googlegroups.com. To post to this group, send email to google-appengine@googlegroups.com. Visit this group at http://groups.google.com/group/google-appengine. For more options, visit https://groups.google.com/d/optout.
Re: [google-appengine] store images in datastore using php
thanks a lot for your reply. Actually i am a novice to GAE. I could not understand your reply very clearly. Is there a difference between "DataStore" and "Cloud DataStore " ? my requirement is that i need to retrieve an image ( for eg: profile photo of the logged in user) quickly at run-time. I learnt that this was possible by storing the data in Datastore. In the Datastore, I am able to store strings (for eg: username, address, etc) using php remote api of the php app engine ( basically using the second link that you have sent ). Basically I have created an entity in the datastore and the entity has fields called "name", "address" ,etc which are of string datatype. I was wondering if I could store the image of a user as well in the datastore by creating another field with suitable datatype for holding images and access the images in the datastore with PHP remote APIs ? Is such a thing possible ? It seems to be possible with python and java (but I have not actually tried it out ) but with php i could not find any solution. any help would be greatly appreciated. Thanks a lot again ! Regards, Rohith On Monday, August 18, 2014 10:18:25 PM UTC+5:30, barryhunter wrote: > > Well PHP runtime doesnt actully have direct access to the DataStore right > now :) > > Have to proxy it though say the Cloud Datastore. > https://developers.google.com/datastore/ > > Which is then just an exercise in accessing a remote API. > > https://gae-php-tips.appspot.com/2013/12/23/getting-started-with-the-cloud-datastore-on-php-app-engine/ > > > > But frankly storing images in the datastore, is probably not the best > practice. > > Using Google Cloud Storage would be better. > https://developers.google.com/appengine/docs/php/googlestorage/ > > > > > > On 16 August 2014 10:26, Rohith D Vallam > > wrote: > >> Hello, >> >> Is there some example code in PHP which will enable me to store / >> retrieve images (jpg, png files) to / from the google datastore ? I found >> example code for python(link: >> https://developers.google.com/appengine/articles/python/serving_dynamic_images >> ) and java (link: >> https://developers.google.com/appengine/articles/java/serving_dynamic_images) >> but >> not for PHP. If someone has a working PHP code for storing / retrieving >> images to / from datastore , it would be great if you could share the code. >> >> Thanks and Regards, >> Rohith >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Google App Engine" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to google-appengi...@googlegroups.com . >> To post to this group, send email to google-a...@googlegroups.com >> . >> Visit this group at http://groups.google.com/group/google-appengine. >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscr...@googlegroups.com. To post to this group, send email to google-appengine@googlegroups.com. Visit this group at http://groups.google.com/group/google-appengine. For more options, visit https://groups.google.com/d/optout.
Re: [google-appengine] store images in datastore using php
On Mon, Aug 18, 2014 at 3:00 PM, Rohith D Vallam wrote: > thanks a lot for your reply. Actually i am a novice to GAE. I could not > understand your reply very clearly. Is there a difference between > "DataStore" and "Cloud DataStore " ? > What Barry is saying is that there's a difference between the Datastore and Google Cloud Storage. The articles you linked to discuss storing images in the datastore, but it is much better to store, process, and serve images using Cloud Storage as the backend. Here is how to upload an image (with code examples): https://developers.google.com/appengine/docs/php/googlestorage/user_upload Here is how to serve the uploaded images: https://developers.google.com/appengine/docs/php/googlestorage/images The datastore is not currently available for PHP-based applications, so if you need to store additional data such as users, address, etc (as you stated in your original post) you'll need to use Cloud SQL: https://developers.google.com/appengine/docs/php/cloud-sql/ - -Vinny P Technology & Media Consultant Chicago, IL App Engine Code Samples: http://www.learntogoogleit.com -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscr...@googlegroups.com. To post to this group, send email to google-appengine@googlegroups.com. Visit this group at http://groups.google.com/group/google-appengine. For more options, visit https://groups.google.com/d/optout.
Re: [google-appengine] store images in datastore using php
As Vinny and others have said... use Google Cloud Storage and dynamic image serving. BUT please also star this issue: https://code.google.com/p/googleappengine/issues/detail?id=9979 To make a long story short... when the dynamic image serving service resizes a jpeg image it effectively uses a quality parameter of 100. So, if you're like me and save a single large-ish image and rely on dynamic image serving to deliver thumbnails and intermediate sizes... you can end up with 2x-3x larger images than necessary. For example, I save images in GCS at 1440x1080. An example image served dynamically with GAE image serving at 320x240 is 34k in size. Taking that same 1440x1080 example image and creating a 320x240 jpeg with quality=85 results in an 18k image and at quality=65 results in an 11k image. Visually, the quality is still decent even at q=65. What I'd like to see is the dynamic image serving default to quality=85... that is a pretty standard setting. Ideally (as the issue mentions) an additional quality parameter could be tacked onto the url (but that is gravy). A simple switch to a default of 85 would save a lot of bandwidth on image heavy apps. On Monday, August 18, 2014 6:09:05 PM UTC-4, Vinny P wrote: > > On Mon, Aug 18, 2014 at 3:00 PM, Rohith D Vallam > wrote: > >> thanks a lot for your reply. Actually i am a novice to GAE. I could not >> understand your reply very clearly. Is there a difference between >> "DataStore" and "Cloud DataStore " ? >> > > > What Barry is saying is that there's a difference between the Datastore > and Google Cloud Storage. The articles you linked to discuss storing images > in the datastore, but it is much better to store, process, and serve images > using Cloud Storage as the backend. > > Here is how to upload an image (with code examples): > https://developers.google.com/appengine/docs/php/googlestorage/user_upload > Here is how to serve the uploaded images: > https://developers.google.com/appengine/docs/php/googlestorage/images > > The datastore is not currently available for PHP-based applications, so if > you need to store additional data such as users, address, etc (as you > stated in your original post) you'll need to use Cloud SQL: > https://developers.google.com/appengine/docs/php/cloud-sql/ > > > - > -Vinny P > Technology & Media Consultant > Chicago, IL > > App Engine Code Samples: http://www.learntogoogleit.com > > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscr...@googlegroups.com. To post to this group, send email to google-appengine@googlegroups.com. Visit this group at http://groups.google.com/group/google-appengine. For more options, visit https://groups.google.com/d/optout.
Re: [google-appengine] store images in datastore using php
thanks for your reply. I have also starred the issue that you mentioned. Regards, Rohith On Thursday, August 21, 2014 8:35:41 PM UTC+5:30, Doug Anderson wrote: > > As Vinny and others have said... use Google Cloud Storage and dynamic > image serving. > > BUT please also star this issue: > https://code.google.com/p/googleappengine/issues/detail?id=9979 > > To make a long story short... when the dynamic image serving service > resizes a jpeg image it effectively uses a quality parameter of 100. So, > if you're like me and save a single large-ish image and rely on dynamic > image serving to deliver thumbnails and intermediate sizes... you can end > up with 2x-3x larger images than necessary. For example, I save images in > GCS at 1440x1080. An example image served dynamically with GAE image > serving at 320x240 is 34k in size. Taking that same 1440x1080 example > image and creating a 320x240 jpeg with quality=85 results in an 18k image > and at quality=65 results in an 11k image. Visually, the quality is still > decent even at q=65. > > What I'd like to see is the dynamic image serving default to quality=85... > that is a pretty standard setting. Ideally (as the issue mentions) an > additional quality parameter could be tacked onto the url (but that is > gravy). A simple switch to a default of 85 would save a lot of bandwidth > on image heavy apps. > > > On Monday, August 18, 2014 6:09:05 PM UTC-4, Vinny P wrote: >> >> On Mon, Aug 18, 2014 at 3:00 PM, Rohith D Vallam >> wrote: >> >>> thanks a lot for your reply. Actually i am a novice to GAE. I could not >>> understand your reply very clearly. Is there a difference between >>> "DataStore" and "Cloud DataStore " ? >>> >> >> >> What Barry is saying is that there's a difference between the Datastore >> and Google Cloud Storage. The articles you linked to discuss storing images >> in the datastore, but it is much better to store, process, and serve images >> using Cloud Storage as the backend. >> >> Here is how to upload an image (with code examples): >> https://developers.google.com/appengine/docs/php/googlestorage/user_upload >> Here is how to serve the uploaded images: >> https://developers.google.com/appengine/docs/php/googlestorage/images >> >> The datastore is not currently available for PHP-based applications, so >> if you need to store additional data such as users, address, etc (as you >> stated in your original post) you'll need to use Cloud SQL: >> https://developers.google.com/appengine/docs/php/cloud-sql/ >> >> >> - >> -Vinny P >> Technology & Media Consultant >> Chicago, IL >> >> App Engine Code Samples: http://www.learntogoogleit.com >> >> > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscr...@googlegroups.com. To post to this group, send email to google-appengine@googlegroups.com. Visit this group at http://groups.google.com/group/google-appengine. For more options, visit https://groups.google.com/d/optout.