নতুন স্থানের ফটোতে স্থানান্তর করুন, নতুন স্থানের ফটোগুলিতে স্থানান্তর করুন, নতুন স্থানের ফটোগুলিতে স্থানান্তর করুন, নতুন স্থানের ফটোগুলিতে স্থানান্তর করুন
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
ইউরোপিয়ান ইকোনমিক এরিয়া (EEA) ডেভেলপার
স্থানের ফটোগুলি আপনাকে আপনার ওয়েব পৃষ্ঠাগুলিতে উচ্চ মানের ফটোগ্রাফিক সামগ্রী যোগ করতে দেয়৷ এই পৃষ্ঠাটি Place ক্লাস (নতুন) এবং PlacesService (লেগেসি) মধ্যে স্থানের ফটো বৈশিষ্ট্যগুলির মধ্যে পার্থক্য ব্যাখ্যা করে এবং তুলনা করার জন্য কিছু কোড স্নিপেট প্রদান করে।
যদি অনুরোধে photos ক্ষেত্র নির্দিষ্ট করা থাকে তাহলে যেকোনো getDetails() অনুরোধের জন্য PlaceResult অবজেক্টের অংশ হিসেবে PlacesService (লেগেসি) 10টি পর্যন্ত PlacePhoto অবজেক্টের একটি অ্যারে প্রদান করে। textSearch() এবং nearbySearch() এর ক্ষেত্রে প্রথম স্থানের ছবি উপলব্ধ থাকলে ডিফল্টরূপে ফেরত দেওয়া হয়।
একটি fetchFields() অনুরোধের অংশ হিসাবে Place ক্লাস 10টি Photo অবজেক্টের একটি অ্যারে প্রদান করে যদি অনুরোধে photos ক্ষেত্রটি নির্দিষ্ট করা থাকে।
নিম্নলিখিত টেবিলটি Place ক্লাস এবং PlacesService মধ্যে স্থানের ফটো ব্যবহারে কিছু প্রধান পার্থক্য তালিকাভুক্ত করে:
ফলাফল বস্তু এবং google.maps.places.PlacesServiceStatus প্রতিক্রিয়া পরিচালনা করতে পদ্ধতিগুলির জন্য একটি কলব্যাক ব্যবহার করা প্রয়োজন৷
প্রতিশ্রুতি ব্যবহার করে, এবং অ্যাসিঙ্ক্রোনাসভাবে কাজ করে।
পদ্ধতিগুলির জন্য একটি PlacesServiceStatus চেক প্রয়োজন৷
কোন প্রয়োজনীয় স্থিতি পরীক্ষা, মান ত্রুটি হ্যান্ডলিং ব্যবহার করতে পারেন. আরও জানুন
PlacesService একটি মানচিত্র বা একটি div উপাদান ব্যবহার করে তাত্ক্ষণিক করা আবশ্যক।
একটি মানচিত্র বা পৃষ্ঠা উপাদানের রেফারেন্স ছাড়াই যেখানে প্রয়োজন সেখানে Place তাত্ক্ষণিক করা যেতে পারে।
কোড তুলনা
স্থান পরিষেবা এবং স্থান শ্রেণীর মধ্যে পার্থক্য চিত্রিত করতে এই বিভাগটি স্থানের ফটোগুলির কোডের তুলনা করে৷ কোড স্নিপেট প্রতিটি নিজ নিজ API-এ ছবি রাখার অনুরোধ করার জন্য প্রয়োজনীয় কোড দেখায়।
স্থান পরিষেবা (উত্তরাধিকার)
নিম্নলিখিত স্নিপেটটি PlacesService ব্যবহার করে ফিরে আসা ফটোগুলি দেখায় এবং পৃষ্ঠায় প্রথম ছবির ফলাফল প্রদর্শন করে৷ এই উদাহরণে, স্থানের বিশদ বিবরণের অনুরোধে name এবং photos ক্ষেত্র সহ একটি স্থানের আইডি উল্লেখ করা হয়। পরিষেবার স্থিতি পরীক্ষা করার পরে প্রথম ফটোটি পৃষ্ঠায় প্রদর্শিত হয়। PlacesService চালু করার সময়, একটি মানচিত্র বা একটি div উপাদান অবশ্যই নির্দিষ্ট করতে হবে; যেহেতু এই উদাহরণে একটি মানচিত্র নেই, তাই একটি div উপাদান ব্যবহার করা হয়।
functiongetPhotos(){// Construct the Place Details request.constrequest={placeId:"ChIJydSuSkkUkFQRsqhB-cEtYnw",fields:["name","photos"],};// Create an instance of PlacesService.constattributionDiv=document.getElementById("attribution-div");constservice=newgoogle.maps.places.PlacesService(attributionDiv);// Check status and display the first photo in an img element.service.getDetails(request,(place,status)=>{if(status===google.maps.places.PlacesServiceStatus.OK && place){constphotoImg=document.getElementById('image-container');photoImg.src=place.photos[0].getUrl({maxHeight:400});}});}
PlacesService এ লেখকের গুণাবলী
PlacesService লেখকের Google প্রোফাইল পৃষ্ঠার দিকে নির্দেশ করে এমন একটি URL ধারণকারী একটি html_attributions স্ট্রিং হিসাবে প্রয়োজনীয় লেখক অ্যাট্রিবিউশন প্রদান করে। নিম্নলিখিত স্নিপেট প্রথম ছবির ফলাফলের জন্য অ্যাট্রিবিউশন ডেটা পুনরুদ্ধার করা দেখায়।
নিম্নলিখিত স্নিপেট প্রদর্শনের নাম এবং স্থানের ফটো সহ স্থানের বিবরণ ফেরত দিতে fetchFields() পদ্ধতি ব্যবহার করে দেখায়। প্রথমে একটি প্লেস আইডি ব্যবহার করে একটি নতুন Place অবজেক্ট ইনস্ট্যান্ট করা হয়, তারপরে fetchFields() এ একটি কল আসে যেখানে displayName এবং photos ক্ষেত্রগুলি নির্দিষ্ট করা হয়। প্রথম স্থানের ছবি তারপর পৃষ্ঠায় প্রদর্শিত হয়. Place ক্লাস ব্যবহার করার সময় পরিষেবার স্থিতি পরীক্ষা করার দরকার নেই, কারণ এটি স্বয়ংক্রিয়ভাবে পরিচালনা করা হয়।
asyncfunctiongetPhotos(){// Use a place ID to create a new Place instance.constplace=newgoogle.maps.places.Place({id:'ChIJydSuSkkUkFQRsqhB-cEtYnw',// Woodland Park Zoo, Seattle WA});// Call fetchFields, passing the needed data fields.awaitplace.fetchFields({fields:['displayName','photos']});console.log(place.displayName);console.log(place.photos[0]);// Add the first photo to an img element.constphotoImg=document.getElementById('image-container');photoImg.src=place.photos[0].getURI({maxHeight:400});}
Place ক্লাসে লেখকের গুণাবলী
Place ক্লাস লেখকের AuthorAttribution উদাহরণ হিসাবে লেখকের নাম, লেখকের Google প্রোফাইল পৃষ্ঠার জন্য একটি URI এবং লেখকের প্রোফাইল ফটোর জন্য একটি URI সহ লেখক বৈশিষ্ট্যগুলি প্রদান করে৷ নিম্নলিখিত স্নিপেট প্রথম ছবির ফলাফলের জন্য অ্যাট্রিবিউশন ডেটা পুনরুদ্ধার করা দেখায়।
[[["সহজে বোঝা যায়","easyToUnderstand","thumb-up"],["আমার সমস্যার সমাধান হয়েছে","solvedMyProblem","thumb-up"],["অন্যান্য","otherUp","thumb-up"]],[["এতে আমার প্রয়োজনীয় তথ্য নেই","missingTheInformationINeed","thumb-down"],["খুব জটিল / অনেক ধাপ","tooComplicatedTooManySteps","thumb-down"],["পুরনো","outOfDate","thumb-down"],["অনুবাদ সংক্রান্ত সমস্যা","translationIssue","thumb-down"],["নমুনা / কোড সংক্রান্ত সমস্যা","samplesCodeIssue","thumb-down"],["অন্যান্য","otherDown","thumb-down"]],["2025-09-04 UTC-তে শেষবার আপডেট করা হয়েছে।"],[],[],null,["# Migrate to the new Place Photos\n\n\u003cbr /\u003e\n\n**European Economic Area (EEA) developers** If your billing address is in the European Economic Area, effective on 8 July 2025, the [Google Maps Platform EEA Terms of Service](https://cloud.google.com/terms/maps-platform/eea) will apply to your use of the Services. Functionality varies by region. [Learn more](/maps/comms/eea/faq).\n\nPlace photos lets you add high quality photographic content to your web pages.\nThis page explains the differences between place photos features in the `Place`\nclass (new) and `PlacesService` (legacy), and provides some code snippets for\ncomparison.\n\n- `PlacesService` (legacy) returns an array of up to 10 [`PlacePhoto`](/maps/documentation/javascript/reference/places-service#PlacePhoto) objects as part of the `PlaceResult` object for any `getDetails()` request if the `photos` field is specified in the request. In the case of `textSearch()` and `nearbySearch()` the first place photo is returned by default if available.\n- The `Place` class returns an array of up to 10 [`Photo`](/maps/documentation/javascript/reference/place#Photo) objects as part of a `fetchFields()` request if the `photos` field is specified in the request.\n\nThe following table lists some of the main differences in the use of place\nphotos between the `Place` class and `PlacesService`:\n\n| [`PlacesService`](/maps/documentation/javascript/reference/places-service) (Legacy) | [`Place`](/maps/documentation/javascript/reference/place) (New) |\n|-----------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------|\n| [`PlacePhoto`](/maps/documentation/javascript/reference/places-service#PlacePhoto) interface | [`Photo`](/maps/documentation/javascript/reference/place#Photo) class |\n| `PlacePhoto` returns [`html_attributions`](/maps/documentation/javascript/reference/places-service#PlacePhoto.html_attributions) as a string. | `Photo` returns an [`AuthorAttribution`](/maps/documentation/javascript/reference/place#AuthorAttribution) instance. |\n| Methods require the use of a callback to handle the results object and `google.maps.places.PlacesServiceStatus` response. | Uses Promises, and works asynchronously. |\n| Methods require a `PlacesServiceStatus` check. | No required status check, can use standard error handling. [Learn more](/maps/documentation/javascript/reference/errors). |\n| `PlacesService` must be instantiated using a map or a div element. | `Place` can be instantiated wherever needed, without a reference to a map or page element. |\n\nCode comparison\n---------------\n\nThis section compares code for place photos to illustrate the differences\nbetween the Places Service and the\nPlace class. The code snippets show the code\nrequired to request place photos on each respective API.\n\n### Places service (legacy)\n\nThe following snippet shows returning photos using `PlacesService`, and\ndisplaying the first photo result on the page. In this example, the place\ndetails request specifies a place ID, along with the `name` and `photos` fields.\nThe first photo is then displayed on the page after checking service status.\nWhen instantiating the `PlacesService`, a map or a `div` element must be\nspecified; since this example does not feature a map, a `div` element is used. \n\n function getPhotos() {\n // Construct the Place Details request.\n const request = {\n placeId: \"ChIJydSuSkkUkFQRsqhB-cEtYnw\",\n fields: [\"name\", \"photos\"],\n };\n\n // Create an instance of PlacesService.\n const attributionDiv = document.getElementById(\"attribution-div\");\n const service = new google.maps.places.PlacesService(attributionDiv);\n\n // Check status and display the first photo in an img element.\n service.getDetails(request, (place, status) =\u003e {\n if (\n status === google.maps.places.PlacesServiceStatus.OK && place\n ) {\n const photoImg = document.getElementById('image-container');\n photoImg.src = place.photos[0].getUrl({maxHeight: 400});\n }\n });\n }\n\n#### Author attributions in `PlacesService`\n\nThe `PlacesService` returns the required author attributions as an\n[`html_attributions`](/maps/documentation/javascript/reference/places-service#PlacePhoto.html_attributions)\nstring containing a URL pointing to the author's Google profile page. The\nfollowing snippet shows retrieving attribution data for the first photo result. \n\n let attributionUrl = place.photos[0].html_attributions;\n\n#### Learn more\n\n- [See the documentation](/maps/documentation/javascript/places#places_photos)\n- [`getDetails` reference](/maps/documentation/javascript/reference/places-service#PlacesService.getDetails)\n- [`PlacePhoto` interface reference](/maps/documentation/javascript/reference/places-service#PlacePhoto)\n\n### Place class (new)\n\nThe following snippet shows using the\n[`fetchFields()`](/maps/documentation/javascript/reference/place#Place.fetchFields)\nmethod to return place details including the display name and place photos.\nFirst a new `Place` object is instantiated using a place ID, followed by a call\nto `fetchFields()` where the `displayName` and `photos` fields are specified.\nThe first place photo is then displayed on the page. There is no need to check\nservice status when using the `Place` class, as this is handled automatically. \n\n async function getPhotos() {\n // Use a place ID to create a new Place instance.\n const place = new google.maps.places.Place({\n id: 'ChIJydSuSkkUkFQRsqhB-cEtYnw', // Woodland Park Zoo, Seattle WA\n });\n\n // Call fetchFields, passing the needed data fields.\n await place.fetchFields({ fields: ['displayName','photos'] });\n\n console.log(place.displayName);\n console.log(place.photos[0]);\n // Add the first photo to an img element.\n const photoImg = document.getElementById('image-container');\n photoImg.src = place.photos[0].getURI({maxHeight: 400});\n }\n\n#### Author attributions in the `Place` class\n\nThe `Place` class returns author attributions as an\n[`AuthorAttribution`](/maps/documentation/javascript/reference/place#AuthorAttribution)\ninstance including the author's name, a URI for the author's Google profile\npage, and a URI for the author's profile photo. The following snippet shows\nretrieving attribution data for the first photo result. \n\n let name = place.photos[0].authorAttributions[0].displayName;\n let attributionUrl = place.photos[0].authorAttributions[0].uri;\n let photoUrl = place.photos[0].authorAttributions[0].photoUri;\n\n#### Learn more\n\n- [See the full example](/maps/documentation/javascript/examples/place-photos)\n- [See the documentation](/maps/documentation/javascript/place-photos)\n- [`fetchFields()` reference](/maps/documentation/javascript/reference/place#Place.fetchFields)\n- [`Photo` class reference](/maps/documentation/javascript/reference/place#Photo)"]]