View Full Version : modifying script to store images to folder
TeamDevotion
10-01-2007, 01:08 AM
I don't really know how to program for databases and such, but i'd like to modify a script that stores pictures to a database, and make it store pictures to a folder.
Dismounted
10-01-2007, 12:23 PM
This is not beginners stuff, so if you don't have a feel of PHP, I would suggest against it as you might end up breaking it.
Dean C
10-01-2007, 12:41 PM
i'd like to modify a script that stores pictures to a database, and make it store pictures to a folder. Your two statements, are contradictory
nexialys
10-01-2007, 01:45 PM
Dean, you did not even read it in the right angle.. lol
the system actually store the pictures in the database, he wants them to be stored in the filesystem instead...
as it is not related to vBulletin, can you provide the url to the script so we can see what's going on with your script !?
... http://ca3.php.net/manual/fr/function.file-put-contents.php ... this can be a lead to somewhere!
RobDog888
10-01-2007, 04:52 PM
<font color="navy">In the admincp you can specify where to store your attachments. It also has functions to move attachments out of the db or back in.</font>
Dismounted
10-02-2007, 05:02 AM
That's for vBulletin. I believe he's talking about a script other then vBulletin.
TeamDevotion
10-06-2007, 06:05 AM
Its the vbgarage script, The reason i want to do this is because the image database for the garage gets extremely large.
when i update my vb version its a pain to import that huge table into the new database.
TeamDevotion
10-10-2007, 03:11 AM
anyone?
Marco van Herwaarden
10-10-2007, 08:17 AM
It would be the best if you posted your question in the thread of that modification. Nobody can give you a generic answer on how to modify script "X" to support attachments in the file system.
Also as mentioned before, if you are not familiar with PHP coding i would advise against trying this yourself as it is not beginners stuff.
TeamDevotion
10-14-2007, 05:44 AM
There is no longer support for the vbgarage script. Beginners have to learn somehow.
neverstop
10-17-2007, 04:43 AM
I am also looking for help with this same problem, albeit with a different modification. This mod allows an image to be uploaded with a link for the vbadvanced links directory (link (http://www.vbadvanced.com/forum/showthread.php?t=19806)).
Here is the relevant code (I think):
$max_height = 500;
$max_width = 200;
if (is_uploaded_file($_FILES['linkimage']['tmp_name']))
{
$imagetype = trim(substr(strrchr(strtolower($_FILES['linkimage']['name']), '.'), 1));
if ($imagetype == "jpeg" OR $imagetype == "jpg" OR $imagetype == "png")
{
// Get new sizes
list($width, $height) = getimagesize($_FILES['linkimage']['tmp_name']);
$new_width = $width;
$new_height = $height;
if ($height > $max_height) {
$new_width = ($max_height / $height) * $width;
$new_height = $max_height;
}
if ($width > $max_width) {
$new_height = ($max_width / $width) * $height;
$new_width = $max_width;
}
$imagedata = imagecreatetruecolor($new_width, $new_height);
}
if ($imagetype == 'jpeg' OR $imagetype == 'jpg')
{
$source = imagecreatefromjpeg($_FILES['linkimage']['tmp_name']);
imagecopyresampled($imagedata, $source, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
ob_start();
imagejpeg($imagedata);
$imagedata = ob_get_contents();
ob_end_clean();
}
elseif ($imagetype == 'gif')
{
$imagedata = file_get_contents($_FILES['linkimage']['tmp_name']);
}
elseif ($imagetype == 'png')
{
$source = imagecreatefrompng($_FILES['linkimage']['tmp_name']);
imagecopyresampled($imagedata, $source, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
ob_start();
imagepng($imagedata);
$imagedata = ob_get_contents();
ob_end_clean();
}
else
{
$imagedata = "";
$imagetype = "";
}
if (!empty($imagedata) AND !empty($imagetype))
{
$imagesql = ", imagedata = '" . addslashes($imagedata) . "', imagetype = '$imagetype'";
}
}
else
{
$imagedata = "";
$imagetype = "";
$imagesql = "";
}
Cheers,
Ian
Dismounted
10-17-2007, 06:43 AM
There is no longer support for the vbgarage script. Beginners have to learn somehow.
Yes, that is true, but you don't just jump into the deep end.
TeamDevotion
10-18-2007, 04:42 AM
It looks like no one really wants to help but just tell me that I shouldn't, i guess i'll take a look at the vbimage host coding and some how tie it into vbgarage.
neverstop
10-19-2007, 02:40 AM
Am not sure if this type of posting is allowed but if anyone wants to tackle this for a fee i am offering it here: https://vborg.vbsupport.ru/showthread.php?t=160423
Again sorry for the spam-ish post.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.