This is from admin/avatar.php (modified):
PHP Code:
makelabelcode("Predefined location:","<select name='basepath'>
<option value='username ASC'>User Name</option>
<option value='email ASC'>Email Address</option>
<option value='usergroup.title ASC'>Usergroup</option>
<option value='posts DESC'>Post Count</option>
<option value='lastvisit ASC'>Last Visit</option>
<option value='joindate DESC'>Join Date</option>
</select>");
// ###################### Start Insert #######################
if ($HTTP_POST_VARS['action']=="insert") {
$DB_site->query("INSERT INTO image (imageid,title,category,imagepath) VALUES (NULL,'".addslashes($title)."','$category ','".addslashes($imagepath)."')");
$action="modify";
echo "<p>Record added</p>";
}
1. How do I add to $imagepath in DB the basepath option (selected) before it - if something is selected? And another problem.
2. I want to use it as a gallery, so if the image width (for example is 400 - there should be 1 item per cell and if the width is 150 - 3 items per cell).
PHP Code:
// image too big?
else
{
$dimensions = @getimagesize($thumbnail['tmp_name']);
if (!$dimensions and !$thumbnailallowdcfail)
{
$key = "unknownerror";
}
else if ($dimensions != false and !$thumbnailallowdcfail)
{
$x = $dimensions[0];
$y = $dimensions[1];
if ($x > $thumbnailx or $y > $thumbnaily)
{
$key = "imagedimensions";
}
else
{
// binary read
$filehandle = @fopen($thumbnail['tmp_name'], "rb");
$thumbnaildata = @fread($filehandle,
filesize($thumbnail['tmp_name']));
@unlink($thumbnail['tmp_name']);
if (empty($thumbnaildata))
{
$key = "unknownerror";
}
}