PDA

View Full Version : Fread error..



jzhang1013
12-18-2008, 05:32 PM
Hey all my site is here (http://www.1013mm.com) for some reason I'm getting a fread error. Can someone look at my coding for me? Every time I reupload the files it all works for about a week or so...... Its getting frustrating...

Thanks.

Nile
12-18-2008, 11:20 PM
Make sure that the file that fread is reading isn't changing because if it is then that could be a posibility. Also can we see your code?


Make sure your function is coded correctly: http://us.php.net/fread

jzhang1013
12-19-2008, 05:07 AM
ok the code is here or the first few lines of it just tell me if you need more..



<?php
//require('sp_config.php');

define("VERSION","Enhanced Simple PHP Gallery 1.7");

if ($editmode==true)
{
$modrewrite = false;
$image_fade_in = false;
}

//DETECT AND STORE GD VERSION IF THIS IS THE FIRST TIME THE SCRIPT IS RUN.
if(!isset($gd_version))
{
$config_file = @fopen('sp_config.php','r');
$contents = fread($config_file, filesize('sp_config.php'));
@fclose($config_file);
$gd_version = gd_version();
$contents = str_replace('?>','$gd_version = "' . $gd_version . "\";\n?" . ">",$contents);
$config_file = @fopen('sp_config.php','w');
@fwrite($config_file, $contents);


and here is the config.php its not 0kb...

This is the config.php, its in the directory. Thing is if I reupload this file the error will go away.... weird.


<?php
$title = 'Photo Gallery';

//Thumbnail Settings
$maxthumbwidth = 120;
$maxthumbheight = 120;
$thumbquality = 75;

//Thumbnail next to category
$cat_thumbs = false;

// Unsharp mask settings for thumbnails
$thumb_applyunsharpmask = true;
$thumb_amount = 50;
$thumb_radius = 0.5;
$thumb_threshold = 2;

//Main Image Resize Settings
$resize = true;
$maxwidth = 600;
$maxheight = 500;
$resizequality = 75;

// Unsharp mask settings for resized images
$resize_applyunsharpmask = true;
$resize_amount = 50;
$resize_radius = 0.5;
$resize_threshold = 2;

//$modrewrite Settings
$modrewrite = false;

//Cache Settings
$cachethumbs = false;
$cachefolder = 'cache';

$cacheresized = false;
$cacheresizedfolder = 'rcache';

//Preload next image
$precache = false;

//Folder Hiding
$hide_folders[] = 'cgi-bin';

// Editing functions
$allowdeleting = true;
$allowmaking = true;

//Max image upload size default is 150Kb or 153600 bytes
$max_size = 153600;

// Number of thumbnails to display on one page
$limit = 15;

//Miscellaneous Settings
$showcomments=false;
$showfolderdetails = true;
$showimgtitles = true;
$showdatesonthumbspage = false;
$alignimages = true;
$image_fade_in = true;// requires javascript

// Sort directories by title (true) or folder name (false)
$sortfoldersbytitle = false;

$gd_version = "2.0.28";
?>

Nile
12-19-2008, 05:12 AM
I need the part of the code that has the fread() function in it.

jzhang1013
12-19-2008, 06:04 AM
$contents = fread($config_file, filesize('sp_config.php'))
in the first code.

Nile
12-19-2008, 06:51 AM
Ok, so try re-uploading it and see if it works.

jzhang1013
12-19-2008, 03:14 PM
it works but the thing is after a week or so the error comes back I've tried that for a month.