Hello arabiansoura,
in this post i will give you another Instruction for the gallery photo.
There are a lot of changes. You can make a COMPONENT for this and
the photos are not streched. The div in the template is invisible the
bigger photo as the div width and hight. We create a thumb3.jpg
and display this photo in the gallery.
1.) admin/function/functions.php
Search:
function photo_resize($photo_in,$photo_out,$photo_vars)
Replace it with this ( I have marked the changes ):
- Code: Select all
//Get resizes photo thumb1; thumb2
function photo_resize($photo_in,$photo_out,$photo_vars)
{
global $site_thumb_width; // Small thumb width
global $site_thumb_height; // Small thumb height
global $site_thumb_width2; // Big thumb width
global $site_thumb_height2; // Big thumb height
// Freddy BOF
global $site_thumb_width3; // Gallery home.tpl thumb width
global $site_thumb_height3; // Gallery home.tpl thumb height
// Freddy EOF
if(file_exists($photo_in))
{
$size = getimagesize ($photo_in);
$wd1=$site_thumb_width;
$wd2=$site_thumb_width2;
// Freddy BOF
$wd3=$site_thumb_width3;
// Freddy EOF
if(isset($size[1]))
{
if($size[0]<$size[1])
{
$wd1=$size[0]*$site_thumb_height/$size[1];
$wd2=$size[0]*$site_thumb_height2/$size[1];
// Freddy BOF
$wd3=$size[0]*$site_thumb_height3/$size[1];
// Freddy EOF
}
}
if($photo_vars==1)
{
easyResize($photo_in,$photo_out,100,$wd1);
}
if($photo_vars==2)
{
easyResize($photo_in,$photo_out,100,$wd2);
}
// Freddy BOF
if($photo_vars==3)
{
easyResize($photo_in,$photo_out,100,$wd3);
}
// Freddy EOF
}
}
2.) admin/function/functions.php
Search the settings entrys like this:
- Code: Select all
if($rs->row["setting_key"]=='model' and $rs->row["activ"]==1){$site_model=true;}
if($rs->row["setting_key"]=='show_model' and $rs->row["activ"]==1){$site_show_model=true;}
if($rs->row["setting_key"]=='flash' and $rs->row["activ"]==1){$site_flash=true;}
and insert under the last entry the following new lines:
- Code: Select all
// Freddy BOF
// Needed for gallery home.tpl
if($rs->row["setting_key"]=='thumb_width_gallery_home_tpl'){$site_thumb_width3=$rs->row["svalue"];}
if($rs->row["setting_key"]=='thumb_height_gallery_home_tpl'){$site_thumb_height3=$rs->row["svalue"];}
// Freddy EOF
3.) Create new settings entrys in the database ( in phpmyadmin )
- Code: Select all
INSERT INTO `settings` VALUES (920, 'Gallery photo thumb width', '700', 0, 'thumb_width_gallery_home_tpl', 920);
INSERT INTO `settings` VALUES (921, 'Gallery photo thumb height', '700', 0, 'thumb_height_gallery_home_tpl', 921);
You can see this two input fields in admin/Settings/Site Settings bottom. The ids are very high
so we have no problems with antons entries.
If this are ready we can change the thumb width or hight and have the data to integrate this
in the upload file. This makes a new thumb like: thumb3.jpg in the size as we have the
entry in Settings.
Now we must insert in the upload file the code, that this thumb are created.
Here I have at the moment only modified for the test the admin/bulk_upload/photo_upload.php
Search this line:
//create thumbs and watermark
Here we have two photo_resize entrys and one publication_watermark_add
The two photo_resize makes the thumb1.jpg and the thumb2.jpg
The one publication_watermark_add makes the watermark for thumb2.jpg
Here we must add the following new line under the last photo_resize:
// Freddy BOF
photo_resize($_SERVER["DOCUMENT_ROOT"].$photo,$_SERVER["DOCUMENT_ROOT"].site_root.$site_servers[$site_server_activ]."/".$folder."/thumb3.jpg",3);
// Freddy EOF
If you will the thumb with watermark then add under the one publication_watermark_add
the new following line:
// Freddy BOF
publication_watermark_add($id,$_SERVER["DOCUMENT_ROOT"].site_root.$site_servers[$site_server_activ]."/".$folder."/thumb3.jpg");
// Freddy EOF
If you look now in the folder ( FTP ) on the server you must have now three thumbs
thumb1.jpg
thumb2.jpg
thumb3.jpg ( new )
We have now ready the first part.
The next part are show this in the home.tpl
4.) admin/Skins/Home page
Here we need a new COMPONENT. That this can work we need a new entry by Content:
admin/home/components.php
admin/home/index.php
Search:
<option value="vector2" <?if($content=="vector2"){echo ............
and insert under this last option:
<option value="photo3" <?if($content=="photo3"){echo("selected");}?>><?=word_lang("photo")?> - home.tpl <?=word_lang("thumbs")?></option>
<option value="vector3" <?if($content=="vector3"){echo("selected");}?>><?=word_lang("vector")?> - home.tpl <?=word_lang("thumbs")?></option>
Now we can create a new COMPONENT Photo - home.tpl thumbs
Insert the new {COMPONENT_XX} in the template home.tpl.
Create a new box_home_gallery.tpl
and insert this code ( I have the css style integrated ):
<div style="margin:0px; width: 656px; height: 276px; overflow: hidden"><a href="{URL}" id="{LINKNAME}" name="{LINKNAME}"><img src="{IMAGE}" border="0" alt="{TITLE}" {LIGHTBOX} id="{IMGNAME}" name="{IMGNAME}"></a></div>
So we have two boxes:
box_home_gallery.tpl = for the gallery photos ( thumb3 )
box_home.tpl = the normal box for the other previews
##### A little change #####
At the moment the div in the box_home_gallery.tpl has the style:
margin:0px; width: 656px; height: 276px; overflow: hidden
The photo begin is in the top left site. If you will this change you can
insert a new style information for this. The value 700 are only a demo.
You can this make smaller for you. Test it out what is the best size for
you.
I have insert in the box_home_gallery.tpl a style for the image. So you
can move the photo. As example more to the top or more to the right
site.
Here the new code ( insert style at the img tag ):
<div style="margin:0px; width: 656px; height: 276px; overflow: hidden"><a href="{URL}" id="{LINKNAME}" name="{LINKNAME}"><img style="position: relative; left: -0px; top: -50px" src="{IMAGE}" border="0" alt="{TITLE}" {LIGHTBOX} id="{IMGNAME}" name="{IMGNAME}"></a></div>
To change the position change the value: left: -50px; top: -50px;
Exmple: left: -0px; top: -100px;
########################
We have now ready the second part.
5.) That the new COMPONENT are work we must change the members/component.php
Search
if(preg_match("/2/",$rs->row["content"])){$ttt=2;}
and insert under the line this:
// Freddy BOF
if(preg_match("/3/",$rs->row["content"])){$ttt=3;}
// Freddy EOF
That we can change between the boxes search this:
$box=file_get_contents($DOCUMENT_ROOT."/".$site_template_url."box_home.tpl");
and replace it with this:
// Freddy BOF
if($ttt==3)
{
$box=file_get_contents($DOCUMENT_ROOT."/".$site_template_url."box_home_gallery.tpl");
}
else
{
$box=file_get_contents($DOCUMENT_ROOT."/".$site_template_url."box_home.tpl");
}
// Freddy EOF
That was it!
I hope i have nothing forgotten and the install well described.
If you have trouble let me know. I have it short tested.
Greetings
Alfred