LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-07-2010, 02:22 AM   #1
amritpalpathak
Member
 
Registered: Feb 2010
Posts: 116

Rep: Reputation: 15
Cool How to show the full resolution image at clicking on thum-nail


There are 5 copies of the same images are placed in a folder i.e. large(1024*768),medium(500*375),small(240*180),thu mnail(75*75),square(100*50) in size....
The following code upload number of Geocoded images(square size) when the page loads.I want when someone click on the any Geocoded image on the page ,it should show the large image(1024*768) of the same.And further click on the large image it must show again the square size image of the same.
Following is the actual code.It is in .js file
.


var epsg4326 = new OpenLayers.Projection("EPSG:4326");
var OSVMain = (function() {
var map, markers, map_move_timeout;
var photos = {};
function mapChange() {
if( map_move_timeout )
clearTimeout(map_move_timeout);
map_move_timeout = setTimeout(mapChangeTimeout, 500);
updateLinks();
}
function updateLinks() {
var center = OSV.getMapCenter(map);
var zoom = map.getZoom();
$('#permalink').attr('href',OSV.getURLBase()+'?lat ='+center.lat+'&lon='+center.lon+'&zoom='+zoom);
$('#kmllink').attr('href',getLocateLink('kml'));
}
function getLocateLink(format) {
var extent = OSV.getMapExtent(map);
var url = OSV.getURLBase()+'/api/photos/locate.'+format+'?bbox=';
url += [ extent.left, extent.bottom, extent.right, extent.top].join(',');
return url;
}
function mapChangeTimeout() {
map_move_timeout = null;
var url = getLocateLink('json');
$.get( url, null, photosLoaded, 'json' );
}
function photosLoaded(json) {
var new_photos = {};
var size = new OpenLayers.Size(50, 50);
var offset = new OpenLayers.Pixel(-25, -25);
for( var i = 0, l = json.length; i < l; ++i ) {
var p = new OSVPhoto(json[i]);
if( photos[p.data.id] ) {
new_photos[p.data.id] = photos[p.data.id];
photos[p.data.id] = null;
} else {
var position = new OpenLayers.LonLat(p.data.lon,p.data.lat);
var icon = new OpenLayers.Icon(p.url('square'), size, offset);
p.marker = new OpenLayers.Marker(position.clone().transform(epsg4 326, map.getProjectionObject()), icon);
new_photos[p.data.id] = p;
markers.addMarker(p.marker);

}
}
for( var k in photos ) {
var p = photos[k];
if( p && p.marker )
markers.removeMarker(p.marker);
}
photos = new_photos;
}
function setup() {
var vectors;
var popup;

map = new OpenLayers.Map($('#map').get(0), {
controls: [
new OpenLayers.Control.ArgParser(),
new OpenLayers.Control.Attribution(),
new OpenLayers.Control.LayerSwitcher(),
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.PanZoomBar()
],
units: "m",
maxResolution: 156543.0339,
numZoomLevels: 20,
displayProjection: new OpenLayers.Projection("EPSG:4326")
});

var mapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik", {
displayOutsideMaxExtent: true,
wrapDateLine: true
});
map.addLayer(mapnik);

var osmarender = new OpenLayers.Layer.OSM.Osmarender("Osmarender", {
displayOutsideMaxExtent: true,
wrapDateLine: true
});
map.addLayer(osmarender);

var numZoomLevels = Math.max(mapnik.numZoomLevels, osmarender.numZoomLevels);

var start = OSV.getStartLocation();
var numzoom = map.getNumZoomLevels();
if (start.zoom >= numzoom) start.zoom = numzoom - 1;
map.setCenter(start.pos.clone().transform(epsg4326 , map.getProjectionObject()), start.zoom);
OSV.setupMapEventHandlers(map);
map.events.register("moveend", map, mapChange);
map.events.register("zoomend", map, mapChange);
mapChange();



markers = new OpenLayers.Layer.Markers("Markers", {
displayInLayerSwitcher: false,
numZoomLevels: numZoomLevels,
maxExtent: new OpenLayers.Bounds(-20037508,-20037508,20037508,20037508),
maxResolution: 156543,
units: "m",
projection: "EPSG:900913"
});
map.addLayer(markers);

}
return {
setup: setup,
1:1
};
})();
$(function(){
OSVMain.setup();
});


Any suggestions ?
Thanking you
 
Old 12-07-2010, 02:42 AM   #2
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,223

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
Why not just use a JQuery lightbox plugin? This is the one I'm using for my video-editing-in-Linux page:

http://net.tutsplus.com/freebies/lig...uery-lightbox/

And here's a tutorial on building one of your own:

http://dryan.com/articles/posts/2009...tbox-tutorial/

Last edited by dugan; 12-07-2010 at 02:45 AM.
 
Old 12-07-2010, 05:38 AM   #3
amritpalpathak
Member
 
Registered: Feb 2010
Posts: 116

Original Poster
Rep: Reputation: 15
Thanks for reply dugan.I dont want to use JQuery lightbox plugin.But can you tell me what the changes should be made in mine own code.??

Thanks
 
Old 12-07-2010, 08:23 AM   #4
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,223

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
The second link is not to a premade plugin, but a tutorial on writing your own lightbox. Therefore, it has the information you want. And your code is already using JQuery anyway.

Furthermore, no-one's going to look at your code if it's formatted like that. You could start by wrapping it in CODE tags, which would preserve the indentation that your source file presumably has. In any case, the code snippet you posted looks completely unrelated to your problem: I can't see anything in there that looks like an attempt to build a lightbox.

Also, mentioning the significant amount of help that you've already had would have been nice...

http://bytes.com/topic/javascript/an...-its-thumbnail

Last edited by dugan; 12-07-2010 at 04:15 PM.
 
1 members found this post helpful.
Old 01-17-2011, 11:35 AM   #5
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,223

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
I can't wait to try this out:

Semantic CSS3 Lightboxes
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
no files on the disk but 'df -h' show it's full junust Linux - General 7 04-22-2010 05:16 AM
KDE 4 Device notifier disappears after clicking on show desktop or workspace applets Laodiceans Slackware 5 08-05-2009 03:03 PM
Linux/df does not show full space sudheerd Linux - Newbie 6 02-14-2008 03:18 AM
ps doesn't show the full command line OlRoy *BSD 2 01-29-2007 09:34 PM
Double-clicking via thum-button solved! lagu2653 Linux - Hardware 3 06-28-2005 09:11 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration