小编use*_*094的帖子

在Google Map中添加标记数组

我需要一些帮助来在Google地图中创建一系列标记,以便它可以更高效,而不是逐个创建标记.我尝试了以下但它不起作用.有人有建议吗?

//create array to store a set of location
var collection = new Array();

//a set of locations stored in array
collection[0] = new google.maps.LatLng(13.742167701649997, 100.50721049308777);
collection[1] = new google.maps.LatLng(13.74428, 100.5404525);
collection[2] = new google.maps.LatLng(13.744108, 100.543098);

var pointMarkerImage = new Array();//store image of marker in array
var pointMarker = new Array();//store marker in array

//create number of markers based on collection.length
function setPoint(){
for(var i=0; i<collection.length; i++){

var pointMarkerImage[i] = new google.maps.MarkerImage('marker.png');
var pointMarker[i] = new google.maps.Marker({
        position: collection[i],
        map: …
Run Code Online (Sandbox Code Playgroud)

javascript google-maps-api-3

12
推荐指数
2
解决办法
6万
查看次数

PHP - 如何将矩形图像转换为方形图像?

如何在php中将矩形图像更改为方形头像,这样无论上传图像的分辨率如何,它都可以调整为集中的42 x 42像素头像.这是我正在使用的PHP代码.任何人都可以建议.

<?php 
//Name you want to save your file as
$save = 'myfile1.jpg';

$file = 'original1.jpg'; 
echo "Creating file: $save"; 
$size = 0.45; 
header('Content-type: image/jpeg') ; 
list($width, $height) = getimagesize($file) ; 
$modwidth = $width * $size; 
$modheight = $height * $size; 
$tn = imagecreatetruecolor($modwidth, $modheight) ; 
$image = imagecreatefromjpeg($file) ; 
imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ; 

// Here we are saving the .jpg, you can make this gif or png if you want …
Run Code Online (Sandbox Code Playgroud)

php image image-processing type-conversion

3
推荐指数
2
解决办法
7490
查看次数