14
« on: June 28, 2007, 12:03:45 AM »
I had some time to spare today so I installed some extra mods on my gallery including this one
So for 4images 1.7.4 it works like this.
Changed files:
- includes/functions.php
- includes/constants.php
- templates/your Template/details.html
- lang/your language/main.php
New files:
- mms.php
- getmms.php
- templates/your Template/mms.html
- templates/your Template/images/mms.gif
Installation
Important: Backup all files
1.)
Open includes/functions.php find:
else {
$user_name = format_text($lang['userlevel_guest'], 2);
$user_name_link = $user_name;
}
add after:
$mms = '<a href="javascript:mms(\''.$site_sess->url(ROOT_PATH."mms.php?id=".$image_row['image_id']."").'\')"><img border="0" src="'.get_gallery_image("mms.gif").'"></a>';
look for
"thumbnail_file_name" => $image_row['image_thumb_file']
));
change to
"thumbnail_file_name" => $image_row['image_thumb_file'],
"mms" => $mms,
));
2.)
open includes/constants.php
find:
// If 4images has problems to find out the right URL, define it here.
// define('SCRIPT_URL', 'http://www.yourdomain.com/4images'); //no trailing slash
replace with:
// If 4images has problems to find out the right URL, define it here.
define('SCRIPT_URL', 'http://www.yourdomain.com/4images'); //no trailing slash
Don't foget 2 edit the line. Your must set your domain!!!
3.)
open templates/your Template/details.html
find:
{header}
add after
<script language="javascript">
function mms(url) {
var winWidth = 700;
var winHeight = 450;
var w = (screen.width - winWidth)/2;
var h = (screen.height - winHeight)/2 - 60;
var name = 'MMS';
var features = 'scrollbars=no,width='+winWidth+',height='+winHeight+',top='+h+',left='+w;
window.open(url,name,features);
}
</script>
3B.)
You can use the {mms} tag in your details template in order to let users recieve mms.
Example
Look for
{download_button}
change to
{download_button} {mms}
4.)
open lang/your language/main.php
add :
//-----------------------------------------------------
//--- Send MMS ----------------------------------------
//-----------------------------------------------------
$lang['mmsheadline'] = "Recieve image over mms";
$lang['imagewidth'] = "Width:";
$lang['imageheight'] = "Height:";
$lang['download'] = "Downlaod";
$lang['id'] = "ID: ";
$lang['mmstext'] = "<b>This picture on your mobile</b><br>
<ul>
<li> Choose in the Services-menu 'Go to address'
<li> Put the following in the gap:<br> <B>{url_mms_id}</B>
<li> Then you see this:<BR> ID: <b>{mms_id}</b><br><b>Download</b>
<li> Choose 'download'
<li> The picture will be loaded. Please be patient.
<li> After the download you see the following:<br> <b>File recieved</b><br>Options - back
<li> Choose <br> <b>Options > Save</b>
<li> Rename the picture and choose a folder.
<li> <b>Now is the picture on your mobile :-)</b>
</ul>To speed things up in the future. Bookmark<br><b> {SCRIPT_URL}/getmms.php </b>on your mobile<br>there you can enter the ID shown above and hit GO";
5.)
create mms.php add the following code:
<?php
define('ROOT_PATH', './');
$main_template = 'mms';
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
$user_access = get_permission();
include(ROOT_PATH.'includes/page_header.php');
$sql = "SELECT image_id, cat_id, image_thumb_file, image_media_file FROM ".IMAGES_TABLE."
WHERE image_id = ".$id."";
$image_row = $site_db->query_firstrow($sql);
$file_size = "n/a";
if ($file_size = @filesize("data/thumbnails/".$image_row['cat_id']."/".$image_row['image_media_file'])) {
$file_size = format_file_size($file_size);
}
$size = @getimagesize("data/thumbnails/".$image_row['cat_id']."/".$image_row['image_thumb_file']."");
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$mms_text = preg_replace("/".$site_template->start."url_mms_id".$site_template->end."/siU", SCRIPT_URL."/getmms.php?id=".$id."", $lang['mmstext']);
$mms_text = preg_replace("/".$site_template->start."mms_id".$site_template->end."/siU", $id, $mms_text);
$mms_text = preg_replace("/".$site_template->start."SCRIPT_URL".$site_template->end."/siU", SCRIPT_URL, $mms_text);
$site_template->register_vars(array(
"thumbnail" => get_thumbnail_code($image_row['image_media_file'], $image_row['image_thumb_file'], $image_row['image_id'], $image_row['cat_id'], $mode, $show_link),
"file_size" => $lang['file_size']." ".$file_size,
"width" => $lang['imagewidth']." ".$size[0]." ".$lang['px'],
"height" => $lang['imageheight']." ".$size[1]." ".$lang['px'],
"mmsheadline" => $lang['mmsheadline'],
"image_id" => $lang['id']."<b>$id</b>",
"text" => $mms_text,
));
$site_template->print_template($site_template->parse_template($main_template));
include(ROOT_PATH.'includes/page_footer.php');
?>
6.)
create getmms.php add the following code:
<?php
define('ROOT_PATH', './');
include(ROOT_PATH.'global.php');
if (!$id) {
echo "Enter image ID";
echo "<form action=\"".SCRIPT_URL."/getmms.php\" method=\"GET\"><input type=\"text\" name=\"id\" size=\"10\"><input type=\"submit\" value=\"GO\" name=\"B1\"></form>";
$site_db->close();
$site_sess->freeze();
exit;
}
$sql = "SELECT image_id, cat_id, image_thumb_file, image_media_file FROM ".IMAGES_TABLE."
WHERE image_id = ".$id."";
$image_row = $site_db->query_firstrow($sql);
echo $lang['id']." ".$id;
echo "
<br>
<a href=\"".SCRIPT_URL."/data/thumbnails/".$image_row['cat_id']."/".$image_row['image_thumb_file']."\">".$lang['download']."</a>";
$site_db->close();
$site_sess->freeze();
exit;
?>
7.)
create templates/your Template/mms.html
you can use the following tags:
- {mmsheadline} to show the headline
- {text} to show the helptext
- {thumbnail} to show the image
- {width} to show the width
- {height} to show the height
- {file_size} to show the file size
- {image_id} the ID when using the bookmark version
Possible example of the template:
<html>
<head>
<title>{site_name}</title>
<link rel="stylesheet" href="{template_url}/style.css">
</head>
<body>
<table width="100%" border="0" cellpadding="3" cellspacing="3">
<tr>
<td class="head1" height="19" colspan="2">{mmsheadline}</td>
</tr>
<tr>
<td class="row2" colspan="2">{image_id}</td>
</tr>
<tr>
<td class="row2" >{text}</td>
<td class="row2" align="center">{thumbnail}<p>{file_size}<p>{width}<p>{height}</td>
</tr>
</table>
<br>{copyright}
</body>
</html>
create a new button templates/your Template/images/mms.gif
Done!
Some information about the mod:
The thumbnails must be max. 128x128 px and the file size shouldn't be heigher than von 18 kb..