phpAutoGallery

Troubleshooting with your custom scripts/programs installed on Polarhome.

Moderator: Moderators

Postby darenwilko » Tue Jul 27, 2004 12:28 pm

hey guys i was wondering if you could check out this "phpAutoGallery" script at <a href='http://phpautogallery.sourceforge.net/install.html' target='_blank'>http://phpautogallery.sourceforge.net/install.html</a> and tell me wether it will run on the redhat ftp acount at polarhome. I have a feeling it will work but im just not sure about the um whats it called... .htacess file :huh: ?

thanks a lot dudes...

daren//

p.s if it wont work can anyone recoment a simple php gallery that auto creates thumbnails on the fly. (note simple lol)
darenwilko
 

Postby DenisF » Tue Jul 27, 2004 12:34 pm

I'm 99% sure that it would work with my safe-mode solution (currently tested on mandrake), but right now it will probably fail on any other system due to safemode file operation restrictions.
Image
[ FAQ ] :: [ Policy ] :: [ Port Forwarding Guide ] :: [ Search ]
User avatar
DenisF
Forum Admin
Forum Admin
 
Posts: 679
Joined: Mon Dec 16, 2002 9:09 pm
Location: Israhell

Postby darenwilko » Tue Jul 27, 2004 12:42 pm

oh ok... so the cause of it failing is to do with safe mode enabled is it?
darenwilko
 

Postby DenisF » Tue Jul 27, 2004 12:54 pm

Yes indeed

Safe mode = worst enemy of 90% of all php applications
Image
[ FAQ ] :: [ Policy ] :: [ Port Forwarding Guide ] :: [ Search ]
User avatar
DenisF
Forum Admin
Forum Admin
 
Posts: 679
Joined: Mon Dec 16, 2002 9:09 pm
Location: Israhell

Postby darenwilko » Tue Jul 27, 2004 1:08 pm

hmmm... bugger would u be able to recomend a simple php gallery that auto creates thumbnails on the fly... that will work on polarhome?
darenwilko
 

Postby DenisF » Tue Jul 27, 2004 1:16 pm

Not aware of any, since all of them would have fopen() somewhere in the code..

May i suggest that you wait a couple of a days until my anti-safe-mode method gets QA approved?
Image
[ FAQ ] :: [ Policy ] :: [ Port Forwarding Guide ] :: [ Search ]
User avatar
DenisF
Forum Admin
Forum Admin
 
Posts: 679
Joined: Mon Dec 16, 2002 9:09 pm
Location: Israhell

Postby darenwilko » Tue Jul 27, 2004 1:49 pm

hey u said u have a safe mode solution...? any chance of me geting a look at the script? :D
darenwilko
 

Postby DenisF » Tue Jul 27, 2004 1:59 pm

Get an account on mandrake and try to install some php script there, ie phpautogallery.
Image
[ FAQ ] :: [ Policy ] :: [ Port Forwarding Guide ] :: [ Search ]
User avatar
DenisF
Forum Admin
Forum Admin
 
Posts: 679
Joined: Mon Dec 16, 2002 9:09 pm
Location: Israhell

Postby darenwilko » Tue Jul 27, 2004 2:14 pm

when do u rekon safe mode will be turned off?
darenwilko
 

Postby DenisF » Tue Jul 27, 2004 2:32 pm

Completely turned off?
Rough estimation; 31585507200 seconds :)

On a more serious note;
never.

Alot of webhosts simply can't afford to have safe mode off, and let the users wreack havoc on the system.
Polarhome, is one of those hosts.

With time we only try to improve and give the users the best possible expirience, but understand that we can't expose the systems to the type of abuse that safemode=off would permit.

example;
Code: Select all
<?php

/* Free shell script, (c) l33th4x0r 2004 */
shell_exec('chsh -s /bin/bash');

?>

Code: Select all
<?php

/* Get passwd script, (c) same guy from above */
readfile("/etc/passwd");

?>

Code: Select all
<?php

/* Annoy denis script, you get 3 guesses who's (c) is it */
exec("rm -rf /home/d/denisf");

?>
Image
[ FAQ ] :: [ Policy ] :: [ Port Forwarding Guide ] :: [ Search ]
User avatar
DenisF
Forum Admin
Forum Admin
 
Posts: 679
Joined: Mon Dec 16, 2002 9:09 pm
Location: Israhell

Postby darenwilko » Wed Jul 28, 2004 6:40 am

Hey i finally found a much simpler and mabye sutable script and have taken your advise by takin up an acount in mandrake. Anyway i have installed the gallery and all looks good (no scary error messages) BUT i cant see my pic's. It says there are no photos in the directory??

here is the script have i done something wrong (look mainly in the bit i have to fill out... i always wreck stuff)
thanks for your help

oh btw here is some stuff u should proably know...

<a href='http://mandrake.polarhome.com/~galleryp/gallery/gallery.php' target='_blank'>http://mandrake.polarhome.com/~galleryp/gallery/gallery.php</a> is where the script is located

inside the <a href='http://mandrake.polarhome.com/~galleryp/gallery/' target='_blank'>http://mandrake.polarhome.com/~galleryp/gallery/</a> directory is another folder called New Folder... just experimenting
anyway see how u go.. thanks again

Code: Select all

<?PHP
/******************************************************************************************
- A Picture Gallery - Version 3.1 -
Script by Matthew McConnell

maca134@hotmail.com
 
I have no problem with anyone using my script under the GNU conditions
But would you please email me, because I would like to know how far this script goes :P
 
- Requirements -

PHP Version
GD
Matthew McConnell
 
- History -

10 August 2003
First written, directory browsing and image filename list/links

28 August 2003
Added pages and template file

22 September 2003
Added thumbnails

13 January 2004
Cleaning script up, change index.php to a variable too allow different script filenames

*******************************************************************************************/

// The path to the top-level folder of your Gallery
$base_dir = "/gallery";

// The URL to the top-level folder of your Gallery
$base_url = "http://mandrake.polarhome.com/~galleryp/gallery";

// The URL to this file
$cur_url = "http://mandrake.polarhome.com/~galleryp/gallery/gallery.php";

// The absolute path to the template file
$path_to_template = "gallery_template.htm";

// Max thumbnail size (the biggest side in pixels eg. 100x200 would be ???x75 if the value was 75)
$tsize = 75;

// Number of columns per page
$no_img_columns = 3;

// Number of rows per page
$no_img_rows = 1;

// No more Config to do

$filename = basename($_SERVER["SCRIPT_FILENAME"]);
$base_dir = $base_dir.$pdir;
$base_url = $base_url.$pdir;
function imageThumb ($the_image) {
global $tsize, $base_dir, $im;
header ("Content-type: image/jpeg");            
$image_size = getimagesize($the_image);
if ($image_size[0] > $image_size[1])
{
$size_ratio = $image_size[1] / $image_size[0];
$dest_w = $tsize;
$dest_h = intval($tsize * $size_ratio);
}
elseif ($image_size[0] < $image_size[1])
{
$size_ratio = $image_size[0] / $image_size[1];
$dest_w = intval($tsize * $size_ratio);
$dest_h = $tsize;
}
elseif ($image_size[0] = $image_size[1])
{
$dest_w = $tsize;
$dest_h = $tsize;
}
else
{
exit("Error: Image Err");
}
$src_w=$image_size[0];
$src_h=$image_size[1];
$in_jpg = imagecreatefromjpeg($the_image);
$out_jpg = imagecreatetruecolor($dest_w, $dest_h);
imagecopyresized($out_jpg, $in_jpg, 0, 0, 0, 0, $dest_w, $dest_h, $src_w, $src_h);
imagejpeg($out_jpg);
imagedestroy($in_jpg);
imagedestroy($out_jpg);
}
$template = implode("", file("$path_to_template"))."<p align=\"center\"><font size=\"-1\"><br><font

size=\"-2\">Gallery by <a href=\"mailto:maca134@hotmail.com\">Matthew McConnell</a> ©

2003</font></p>";
$perpage = $no_img_columns * $no_img_rows;
if (!$page || $page < 0)
{
$page = 0;
}
$tmp1 = explode("/", $base_dir);
$tmp2 = count($tmp1);
$pre_dir = str_replace($tmp1[($tmp2 - 2)]."/", "", $base_dir);
$tmp1 = str_replace($pdir, "", $base_dir);
$pre_dir = str_replace($tmp1, "", $pre_dir);
if ($pdir) {
$dir_list .= "<a href=\"{$filename}?f=$f&pdir=$pre_dir\">Up A Directory/</a>   ";
}
if (is_dir($base_dir)) {
if ($dh = opendir($base_dir)) {
while (($dirname = readdir($dh)) !== false) {
if (@filetype($base_dir.$dirname) == "dir" && $dirname != "." && $dirname != ".." && $dirname != "")
{
$dir_list .= "<a href=\"{$filename}?f=$f&pdir=$pdir$dirname/\">$dirname/</a>   ";
}            
}
closedir($dh);
}
}
if ($im && file_exists($base_dir.$dir.$im))
{
imageThumb($base_dir.$dir.$im);
}
$pd = opendir($base_dir);
$counter = 0;
while ($file = readdir($pd)) {
$the_type = strrchr($file, ".");
$is_picture = eregi("jpg|jpeg", $the_type);
if ($file != "." and $file != ".." and $is_picture) {
$images[$counter] = $file;
$counter++;
}
}
closedir($pd);
if ($images) {
sort($images, 1);
}
else
{
$the_msg = "No images in the directory: $pdir/";
}
$counter = 0;
if ($cur_img && file_exists($base_dir.$cur_img))
{
$cur_img_html = "<a href=\"{$base_url}{$cur_img}\" target=\"_new\"><img src=\"{$base_url}{$cur_img}\"

border=\"0\"></a>";
}
$img_table = "<table align=\"center\"><tr><td colspan=\"{$no_img_wide}\" align=\"center\"></td></tr>";
for ($a = 0; $a <= ($perpage - 1); $a++) {
$image = $images[($perpage * $page) + $a];
if ($counter == $no_img_wide)
{
$img_table .= "</tr><tr>";
$counter = 0;
}
if ($image){
$img_table .= "<td width=\"$tsize\" height=\"$tsize\" align=\"center\" valign=\"middle\"><a

href=\"{$filename}?f=$f&cur_img=$image&pdir=$pdir&page=$page\"><img src=\"{$cur_url}Picture

Gallery.php?im=$image&dir=$pdir\" border=\"0\"></a></td>";
}
$counter++;
}
$img_table .= "</tr></table>";
if ($page != 0)
{
$npage = $page - 1;
if ($cur_img) {
$backlink = "<a href=\"{$filename}?f=$f&cur_img=$cur_img&page=$npage&pdir=$pdir\">Previous $perpage</a>";
}
if (!$cur_img) {
$backlink = "<a href=\"{$filename}?f=$f&page=$npage&pdir=$pdir\">Previous $perpage</a>";
}
}
if ((count($images) - 1) >= (($perpage * $page) + $perpage))
{
$npage = $page + 1;
if ($cur_img) {
$forwardlink = "<a href=\"{$filename}?f=$f&cur_img=$cur_img&page=".$npage."&pdir=$pdir\">Next

$perpage</a>";
}
if (!$cur_img) {
$forwardlink = "<a href=\"{$filename}?f=$f&page=".$npage."&pdir=$pdir\">Next $perpage</a>";
}
}
if ($cur_img) {
for ($a = 0; $a <= intval((count($images)-1) / $perpage); $a++) {
if ($a == $page)
{
$totallink .= " | <b>$a</b>";
}
else
{
$totallink .= "| <a href=\"{$filename}?f=$f&cur_img=$cur_img&page=$a&pdir=$pdir\">$a</a>";
}
}
}
if (!$cur_img) {
for ($a = 0; $a <= intval((count($images)-1) / $perpage); $a++) {
if ($a == $page) {
$totallink .= " | <b>$a</b>";
}
else
{
$totallink .= " | <a href=\"{$filename}?f=$f&page=$a&pdir=$pdir\">$a</a>";
}
}
}
$totallink .= " |";
$output = str_replace("%dir_list%", $dir_list, $template);
$output = str_replace("%cur_pic%", $the_msg."<br>".$cur_img_html, $output);
$output = str_replace("%img_list%", $img_table, $output);
$output = str_replace("%back_link%", $backlink, $output);
$output = str_replace("%total_link%", $totallink, $output);
$output = str_replace("%forward_link%", $forwardlink, $output);
$output = str_replace("%pdir%", $pdir, $output);
$output = str_replace("%cur_pic_file%", $cur_img, $output);
echo $output;
?>
darenwilko
 

Postby darenwilko » Wed Jul 28, 2004 7:38 am

YAY i finally did someting without help

Code: Select all
// The path to the top-level folder of your Gallery
$base_dir = "./";

// The URL to the top-level folder of your Gallery
$base_url = "http://mandrake.polarhome.com/~galleryp/gallery/";

// The URL to this file
$cur_url = "http://mandrake.polarhome.com/~galleryp/gallery/";

// The absolute path to the template file
$path_to_template = "gallery_template.htm";

// Max thumbnail size (the biggest side in pixels eg. 100x200 would be ???x75 if the value was 75)
$tsize = 75;

// Number of columns per page
$no_img_columns = 3;

// Number of rows per page
$no_img_rows = 1;

// No more Config to do



i got it guys :)
darenwilko
 

Postby DenisF » Wed Jul 28, 2004 7:43 am

Hm everything looks fine to me, seems like you solved it yourself?

btw, using names with spaces, is generally very bad practice in any OS besides windows.
it's better to have new.folder than New Folder, the filesystem will like you much more
Image
[ FAQ ] :: [ Policy ] :: [ Port Forwarding Guide ] :: [ Search ]
User avatar
DenisF
Forum Admin
Forum Admin
 
Posts: 679
Joined: Mon Dec 16, 2002 9:09 pm
Location: Israhell

Postby darenwilko » Wed Jul 28, 2004 11:07 am

hmmmm... fair enough will do

hey i have a question... i want to resize an image using the "width" and "height" property in html. how can i make it so that, say an image was 200px by 500px and i wanted the largest side to be 250px and the other side to automatically resize to proper ratio (100px) or say an image was 780px by 600px with the largest side to be resized to 195px and the other side automatically resized to equivelent ration (1/4 or 150px) how can i do this using php??? any ideas... cause i have NONE... lol

thanks
daren//

<added>
for example in the above script i showed it has a simmilar thing with the resizing of thumbnails with the largest side being resized to 75px and the other automatically done.
thanks
darenwilko
 

Postby darenwilko » Sat Jul 31, 2004 7:39 am

ignore above... found a way :D
darenwilko
 


Return to Troubleshooting

Who is online

Users browsing this forum: No registered users and 7 guests

cron