如何减少Facebook共享图像大小。

时间:2016-07-15 11:31:17

标签: facebook drupal sharing

我正在使用图片// Code goes here var app = angular.module('app', ['ngAnimate','ui.grid.edit','ui.grid.selection','ui.grid.resizeColumns', 'ui.grid.cellNav', 'ngTouch', 'ui.grid', 'ui.grid.grouping' ]); app.controller('SmartOfficeController', ['$scope', '$http', '$interval', 'uiGridGroupingConstants', function ($scope, $http, $interval, uiGridGroupingConstants ) { $scope.gridOptions = { enableFiltering: false, enableColumnResizing: true, enableRowSelection: true, treeRowHeaderAlwaysVisible: false, rowTemplate:'metricRowTemplate.html', enableColumnMenus: false, columnDefs: [ { field: 'MetricName',displayName:'Metric Name', headerCellClass: 'white' , grouping: { groupPriority: 0 }, width: '35%', cellTemplate: '<div><div ng-if="!col.grouping || col.grouping.groupPriority === undefined || col.grouping.groupPriority === null || ( row.groupHeader && col.grouping.groupPriority === row.treeLevel )" class="ui-grid-cell-contents" title="TOOLTIP">{{COL_FIELD CUSTOM_FILTERS}}</div></div>' }, { name: 'MetricGoalName', headerCellClass: 'white' , cellFilter: 'mapGender' }, { name: 'SubMetricGoalName', headerCellClass: 'white' , }, { name: 'MetricValue',displayName:'MetricValue', headerCellClass: 'white' ,cellTemplate: 'metricCellTemplate.html'}, { name: 'Comments',displayName:'Comments', headerCellClass: 'white' , cellTemplate: 'metricCellTemplate.html'}, {name:'Save', headerCellClass: 'white' ,cellTemplate:'metricSaveTemplate.html'} ], onRegisterApi: function( gridApi ) { $scope.gridApi = gridApi; }, isRowSelectable: function(row){ return row.entity.IsApplicable; } }; $scope.save=function(e,data){ console.log("I have hit the save button"); }; $scope.saveAll=function(){ var selectedRows=$scope.gridApi.selection.getSelectedRows(); alert(selectedRows); alert("You clicked Save All button"); }; $http.get('https://cdn.rawgit.com/angular-ui/ui-grid.info/gh-pages/data/500_complex.json') .success(function(data) { for ( var i = 0; i < data.length; i++ ){ var registeredDate = new Date( data[i].registered ); data[i].state = data[i].address.state; data[i].gender = data[i].gender === 'male' ? 1: 2; data[i].balance = Number( data[i].balance.slice(1).replace(/,/,'') ); data[i].registered = new Date( registeredDate.getFullYear(), registeredDate.getMonth(), 1 ) } delete data[2].age; $scope.gridOptions.data =[{ "MetricGoalDetailID": 1, "MetricID": 1, "MetricName": "Quality", "MetricGoalID": 1, "MetricGoalName": "Data accuracy of deliverables", "SubMetricGoalID": 1, "SubMetricGoalName": "SW Defect density: <= 0.4% of lines of code", "MetricValue":0, "Comments":"Dummy Comments1", "TrackingMonth":"", "IsApplicable":true }, { "MetricGoalDetailID": 2, "MetricID": 1, "MetricName": "Quality", "MetricGoalID": 1, "MetricGoalName": "Data accuracy of deliverables", "SubMetricGoalID": 2, "SubMetricGoalName": "Reporting: >= 99.5%", "MetricValue":0.5, "Comments":"Dummy Comments2", "TrackingMonth":"", "IsApplicable":false }, { "MetricGoalDetailID": 3, "MetricID": 1, "MetricName": "Quality", "MetricGoalID": 1, "MetricGoalName": "Data accuracy of deliverables", "SubMetricGoalID": 3, "SubMetricGoalName": "Data Management:  >= 99.5%", "MetricValue":12.4, "Comments":"Dummy Comments3", "TrackingMonth":"", "IsApplicable":false }, { "MetricGoalDetailID": 4, "MetricID": 2, "MetricName": "Cost", "MetricGoalID": 1, "MetricGoalName": "MIB / CAPG support (Early Engagement, Cost Analysis, App Dev)", "SubMetricGoalID": 4, "SubMetricGoalName": "$25M", "MetricValue":4.5, "Comments":"Dummy Comments4", "TrackingMonth":"", "IsApplicable":true }, { "MetricGoalDetailID": 5, "MetricID": 2, "MetricName": "Cost", "MetricGoalID": 1, "MetricGoalName": "Sales order enablement (M$)", "SubMetricGoalID": 5, "SubMetricGoalName": "Running total", "MetricValue":09.7, "Comments":"Dummy Comments5", "TrackingMonth":"", "IsApplicable":false }, { "MetricGoalDetailID": 6, "MetricID": 2, "MetricName": "Cost", "MetricGoalID": 1, "MetricGoalName": "Revenue Acceleration (M$)", "SubMetricGoalID": 6, "SubMetricGoalName": "Running total", "MetricValue":3.4, "Comments":"Dummy Comments6", "TrackingMonth":"", "IsApplicable":true } ]; }); }]) .filter('mapGender', function() { var genderHash = { 1: 'male', 2: 'female' }; return function(input) { var result; var match; if (!input){ return ''; } else if (result = genderHash[input]) { return result; } else if ( ( match = input.match(/(.+)( \(\d+\))/) ) && ( result = genderHash[match[1]] ) ) { return result + match[2]; } else { return input; } }; }); app.directive('validNumber', function() { return { require: '?ngModel', link: function(scope, element, attrs, ngModelCtrl) { if(!ngModelCtrl) { return; } ngModelCtrl.$parsers.push(function(val) { if (angular.isUndefined(val)) { var val = ''; } var clean = val.replace(/[^-0-9\.]/g, ''); var negativeCheck = clean.split('-'); var decimalCheck = clean.split('.'); if(!angular.isUndefined(negativeCheck[1])) { negativeCheck[1] = negativeCheck[1].slice(0, negativeCheck[1].length); clean =negativeCheck[0] + '-' + negativeCheck[1]; if(negativeCheck[0].length > 0) { clean =negativeCheck[0]; } } if(!angular.isUndefined(decimalCheck[1])) { decimalCheck[1] = decimalCheck[1].slice(0,2); clean =decimalCheck[0] + '.' + decimalCheck[1]; } if (val !== clean) { ngModelCtrl.$setViewValue(clean); ngModelCtrl.$render(); } return clean; }); element.bind('keypress', function(event) { if(event.keyCode === 32) { event.preventDefault(); } }); } }; }); ,但我使用

将其裁剪为200 * 200
1024*768

但它没有被裁剪,在facebook中显示图像的全宽。共享后是否有其他方法可以裁剪图像。?提前致谢。
我在drupal中使用addThis模块。

1 个答案:

答案 0 :(得分:0)

og:image:width不是“种植”财产;它的目的是预先告诉刮刀真实的图像尺寸。

如果您想使用200px * 200px图像 - 那么您可以将其指定为og:image