手机app图片预览放大源码_图片放大安卓

hacker|
128

文章目录:

怎么放大网页图片?有网页图片放大代码吗?

你好,这个是我收集的图片特效代码,只要放入网页源代码中就可以了 meta http-equiv="Content-Type" content="text/html; charset=utf-8" / title(js图片放大预览鼠标滑过的任意位置)_webjx.com/title script language="JavaScript" !-- var srcX = 1024; //原图大小,可以任意设置 var srcY = 768; var bigX = 300; //预览窗大小,可以任意设置 var bigY = 225; var smallX = 300; //缩略图宽度 var smallY = srcY * smallX / srcX; var viewX = bigX / srcX * smallX; //预览范围 var viewY = bigY / srcY * smallY; var bl = srcX / smallX;//缩小比例 var border = 1; //边框 window.onload=function (){ head.innerHTML="JS+CSS实现图片放大预览效果,鼠标可以滑动图片任意地方"; smallpic.width=smallX; smallpic.height=smallY; bigpic.width=srcX; bigpic.height=srcY; view.style.width=viewX; view.style.height=viewY; smallbox.style.borderWidth=border; bigbox.style.borderWidth=border; if (window.event){ smallbox.style.width=smallpic.offsetWidth+border*2; smallbox.style.height=smallpic.offsetHeight+border*2; bigbox.style.width=bigX+border*2; bigbox.style.height=bigY+border*2; }else{ smallbox.style.width=smallpic.offsetWidth; smallbox.style.height=smallpic.offsetHeight; bigbox.style.width=bigX; bigbox.style.height=bigY; } move(event); } function move(e){ var e = window.event?window.event:e; var iebug = 0; if (window.event){ var vX = e.offsetX - viewX/2; var vY = e.offsetY - viewY/2; }else{ var vX = e.pageX - viewX/2 - smallbox.offsetLeft - border; var vY = e.pageY - viewY/2 - smallbox.offsetTop - border; iebug = 2; } if (vX 0) vX = 0; if (vY 0) vY = 0; if (vX smallX - viewX - iebug) vX = smallX - viewX - iebug; if (vY smallY - viewY - iebug) vY = smallY - viewY - iebug; bigpico.style.marginLeft = - vX * bl bigpico.style.marginTop = - vY * bl view.style.left = vX + smallbox.offsetLeft + border; view.style.top = vY + smallbox.offsetTop + border; } //-- /script style type="text/css" !-- *{padding:0;margin:0} img{display:block;} #smallbox{border:1px #c33 solid;float:left;width:0;height:0;overflow:hidden} #bigbox{border:1px #c33 solid;width:0px;height:0px;float:left;overflow:hidden} #view{border:1px #ddd solid;width:0px;height:0px;position:absolute} #head{text-align:center;line-height:40px;font:bold 16px/40px;color:red} //-- /style div id="head"/div div id="smallbox"img src=" files/090716/1_192312.jpg" name="smallpic" width="300" height="300" border="0" id="smallpic" onmousemove="move(event)" onmouseover="document.getElementById('bigbox').style.display='';document.getElementById('view').style.display=''" onmouseout="document.getElementById('bigbox').style.display='none';document.getElementById('view').style.display='none'"/div div id="bigbox" style="display:none"div id="bigpico"img src=" files/090716/1_192312.jpg" name="bigpic" width="300" height="300" border="0" id="bigpic"/div /div div id="view" onmousemove="move(event) "style="display:none"/div

求淘宝上图片放大的代码啊,求大神啊,我很急用啊

onmouseover="changebig()"

function changebig(){

$("#imgid").attr("style","width;xxx;height:xxx;");

}

这个是大概原理了,如果要看源代码也很简答,你打开淘宝,然后在页面上右键,选择查看源代码,然后找到相关代码就可以了。

img src 图片预览的问题 附源码

浏览器安全性已经大大提高,要实现图片上传预览不是那么简单了

不过有很多变通或先进的方法来实现

例如ie7/ie8的滤镜预览法,firefox 3的getAsDataURL方法

具体可以参考这个图片上传预览效果

求解 android 图片点击一下就放大到全屏,再点一下就回到原界面,这个android源码谁有呢?

package com.pic;

import android.app.Activity;

import android.graphics.Bitmap;

import android.graphics.BitmapFactory;

import android.graphics.Matrix;

import android.os.Bundle;

import android.view.Display;

import android.view.KeyEvent;

import android.view.MotionEvent;

import android.widget.ImageView;

public class TestanroidpicActivity extends Activity {

/** Called when the activity is first created. */

Bitmap bp=null;

ImageView imageview;

float scaleWidth;

float scaleHeight;

int h;

boolean num=false;

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

Display display=getWindowManager().getDefaultDisplay();

imageview=(ImageView)findViewById(R.id.imageview);

bp=BitmapFactory.decodeResource(getResources(),R.drawable.icon);

int width=bp.getWidth();

int height=bp.getHeight();

int w=display.getWidth();

int h=display.getHeight();

scaleWidth=((float)w)/width;

scaleHeight=((float)h)/height;

imageview.setImageBitmap(bp);

}

@Override

public boolean onTouchEvent(MotionEvent event) {

switch(event.getAction()){

case MotionEvent.ACTION_DOWN:

if(num==true) {

Matrix matrix=new Matrix();

matrix.postScale(scaleWidth,scaleHeight);

Bitmap newBitmap=Bitmap.createBitmap(bp, 0, 0, bp.getWidth(), bp.getHeight(), matrix, true);

imageview.setImageBitmap(newBitmap);

num=false;

}

else{

Matrix matrix=new Matrix();

matrix.postScale(1.0f,1.0f);

Bitmap newBitmap=Bitmap.createBitmap(bp, 0, 0, bp.getWidth(), bp.getHeight(), matrix, true);

imageview.setImageBitmap(newBitmap);

num=true;

}

break;

}

return super.onTouchEvent(event);

}

}

如何在jsp中实现图片的放大预览

无论你是jsp,asp 。比较好的实现,当然用javascript

jsp也没什么特别,一样可以用javascript。

用javascript框架jquery + 一个插件Cloud Zoom

上网搜下cloud zoom的用法有很多html的例子,移植下就行了

2条大神的评论

  • avatar
    访客 2022-11-21 下午 03:42:29

    cs.Matrix; import android.os.Bundle; import android.view.Display; import android.view.KeyEvent; import android.view.MotionEvent; import andro

  • avatar
    访客 2022-11-21 下午 06:50:13

    ewBitmap=Bitmap.createBitmap(bp, 0, 0, bp.getWidth(), bp.getHeight(), matrix, true); imageview.setImageBitma

发表评论