GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Programming Question (https://gfy.com/showthread.php?t=889758)

FreeHugeMovies 02-23-2009 09:38 PM

Programming Question
 
A worker of mine has uploaded X amount of pics that are too big for normal web viewing. I asked my programmer make them smaller.

He says he can't due to "The data stored on the database are binary and cannot be resize."

Is this true?

who 02-23-2009 09:40 PM

Firstly, his english sux. Secondly:

http://www.bestweekever.tv/bwe/image...%20PSYCHED.jpg

pimplink 02-23-2009 09:47 PM

never heard something like that

FreeHugeMovies 02-23-2009 09:49 PM

Nothing I can do with it, its stored in binary you cannot resize it. That is
the actual binary data of the image. The image is too big.

masterwebmonkey 02-23-2009 10:09 PM

my question would be can you get the "blob" out of the database?
blob stands for binary large object ... the only way i can see that as true is if the data is so large it became corrupt on the way in (meaning the photos too large to be stored) which i highly doubt.

masterwebmonkey 02-23-2009 10:11 PM

If you can get get the blob out ... you can use database calls to get data out ... then use GD to resize and then save back to the database.

jwerd 02-23-2009 10:16 PM

Quote:

Originally Posted by masterwebmonkey (Post 15541327)
If you can get get the blob out ... you can use database calls to get data out ... then use GD to resize and then save back to the database.

exactly :)

but from my experience, I would also have to say he should probably take those images out of db and just make a reference to them instead, makes more sense to me anyways....

FreeHugeMovies 02-23-2009 10:18 PM

The images are fucking 18 MB in size. So they may be too big to BLOB?

masterwebmonkey 02-23-2009 10:22 PM

MySQL supports BLOBs (Binary Large Objects), which means you can store any binary file into MySQL. Many people ask, what is the maximum size of a BLOB in MySQL.

The theoretical limit in MySQL 4.0 is 2G, however each blob requires generally to have 3 copies of it in the memory (stored in various buffers) so you need a lot of memory, if you have large BLOBs stored in MySQL. This is the reason, why the theoretical limit can be reached only on 64bit systems. The Practical limits are around some hundreds of megs per BLOB.

FreeHugeMovies 02-23-2009 10:26 PM

Quote:

Originally Posted by masterwebmonkey (Post 15541357)
MySQL supports BLOBs (Binary Large Objects), which means you can store any binary file into MySQL. Many people ask, what is the maximum size of a BLOB in MySQL.

The theoretical limit in MySQL 4.0 is 2G, however each blob requires generally to have 3 copies of it in the memory (stored in various buffers) so you need a lot of memory, if you have large BLOBs stored in MySQL. This is the reason, why the theoretical limit can be reached only on 64bit systems. The Practical limits are around some hundreds of megs per BLOB.

You lost me after MySQL :winkwink:

masterwebmonkey 02-23-2009 10:26 PM

Quote:

Originally Posted by lamerhooD (Post 15541338)
exactly :)

but from my experience, I would also have to say he should probably take those images out of db and just make a reference to them instead, makes more sense to me anyways....

I would agree ... use the web server to serve files ... use the database to serve data by that I mean text... it will scale better in the long run

masterwebmonkey 02-23-2009 10:30 PM

Quote:

Originally Posted by FreeHugeMovies (Post 15541364)
You lost me after MySQL :winkwink:

"blobs can be hundreds of megs" was the answer ... so while big 18 megs is not bigger than the field size.

so in answer to your original question ... your guy is blowing smoke up your ass.

fallenmuffin 02-23-2009 10:32 PM

You should just make references to the images in the db not store them in there. As mentioned..

You might look into creating a solution with http://www.php.net/manual/en/functio...fromstring.php then using gdlib to resize it and save.

fallenmuffin 02-23-2009 10:35 PM

If he's lazy tell him to mod and try this..

Code:

$desired_width = 500;
$desired_height = 500;

$im = imagecreatefromstring($blobcontents);
$new = imagecreatetruecolor($desired_width, $desired_height);

$x = imagesx($im);
$y = imagesy($im);

imagecopyresampled($new, $im, 0, 0, 0, 0, $desired_width, $desired_height, $x, $y);

imagedestroy($im);

header('Content-type: image/jpeg');
imagejpeg($new, null, 85);


masterwebmonkey 02-23-2009 10:40 PM

giving away the farm ... ;-)

Killswitch - BANNED FOR LIFE 02-23-2009 10:45 PM

First, your programmer is an idiot for storing an image in MySQL, second, like said already, it can be done, your programmer is not only an idiot, but lazy.

If you want to tell him to eat shit and die, my contact info is in my sig, I can not only take all the images out of your database, resize them all to what you want, and restore the LOCATION in the database, and edit the script itself to upload the image to your server and input the LOCATION in the database.

ExLust 02-23-2009 10:51 PM

Yes that's true. But I believe there's a way to view pics in a normal web view.

masterwebmonkey 02-23-2009 10:55 PM

Did I mention I'm looking for work ...

Redrob 02-23-2009 10:56 PM

If you have the photo files in a single directory, you can batch resize using photoshop and they will stay where they are with the same names: just be smaller.

SeanLEE 02-23-2009 10:57 PM

Anyhting is possible. Your programmer is lazy! Put more pressure on him. A skilled programmer can accomplish anything with the right logic. [Ive got an office full of programmers- let me know if you need anything]

Look me up on AdultLinkExchange.com

FreeHugeMovies 02-23-2009 11:02 PM

I'm copying and pasting your comments and then e mailing them to him. Will give you guys his answer.

FreeHugeMovies 02-23-2009 11:04 PM

Quote:

Originally Posted by masterwebmonkey (Post 15541441)
Did I mention I'm looking for work ...

I hear ya but he's been working for me for a while and hes a lot cheaper than you are for sure! I know you get what you pay for but he normally doesn't do stuff like this!

fallenmuffin 02-23-2009 11:07 PM

I gave you the method and code snippets lol he should have it done in 10 minutes.

FreeHugeMovies 02-23-2009 11:09 PM

Quote:

Originally Posted by fallenmuffin (Post 15541477)
I gave you the method and code snippets lol he should have it done in 10 minutes.

I E Mailed him playa, will let you know and thank you all for your help.

ExLust 02-23-2009 11:14 PM

Also, the programmer can create a utlity to resize the image. If he can't do that then he must not be a good programmer.

Alky 02-24-2009 01:37 AM

Quote:

Originally Posted by Redrob (Post 15541445)
If you have the photo files in a single directory, you can batch resize using photoshop and they will stay where they are with the same names: just be smaller.

thanks for the tip lol... did you read the thread?

FreeHugeMovies 02-24-2009 08:37 AM

This might get interesting.

"Those guys are bullshit!!!


Of course the image are stored in BLOB, how can you store in db if it is not in a BLOB format????

The problem is not the DB etc etc.

I'm just telling you that the image are too big. The image size I think is > 3MB.


I will try if I can resize it.
"

jwerd 02-24-2009 08:53 AM

Quote:

Originally Posted by FreeHugeMovies (Post 15542658)
This might get interesting.

"Those guys are bullshit!!!


Of course the image are stored in BLOB, how can you store in db if it is not in a BLOB format????

The problem is not the DB etc etc.

I'm just telling you that the image are too big. The image size I think is > 3MB.


I will try if I can resize it.
"

$query = "select id, content from big_table_of_images";
// do some nifty for loop or while loop, doesn't matter...
// inside that, use the gd library to resize on the fly
// then update big_table_of_images set `content` = $new_size where `id` ='$row['id'].';

not too hard, maybe 10 minutes worth of work. but i'll say again, you will be able to scale much better if you keep it out of db and simply reference it...

goodluck :thumbsup:thumbsup

Killswitch - BANNED FOR LIFE 02-24-2009 09:34 AM

Quote:

Originally Posted by lamerhooD (Post 15542723)
$query = "select id, content from big_table_of_images";
// do some nifty for loop or while loop, doesn't matter...
// inside that, use the gd library to resize on the fly
// then update big_table_of_images set `content` = $new_size where `id` ='$row['id'].';

not too hard, maybe 10 minutes worth of work. but i'll say again, you will be able to scale much better if you keep it out of db and simply reference it...

goodluck :thumbsup:thumbsup

:thumbsup:thumbsup:thumbsup

Fire your programmer, he's worthless.

woj 02-24-2009 09:55 AM

The problem is probably that the images are too big, php runs out of memory and/or times out, and is unable to process them... with default php settings you won't be able to process 18 MB images with gd/php... :2 cents:

Zorgman 02-24-2009 10:06 AM

INSERT INTO programmer_got_fucked SET message='First, your programmer is an idiot for storing an image in MySQL, second, like said already, it can be done, your programmer is not only an idiot, but lazy. If you want to tell him to eat shit and die, my contact info is in my sig, I can not only take all the images out of your database, resize them all to what you want, and restore the LOCATION in the database, and edit the script itself to upload the image to your server and input the LOCATION in the database.', date=NOW()
:thumbsup

Killswitch - BANNED FOR LIFE 02-24-2009 10:08 AM

Quote:

Originally Posted by Zorgman (Post 15543002)
INSERT INTO programmer_got_fucked SET message='First, your programmer is an idiot for storing an image in MySQL, second, like said already, it can be done, your programmer is not only an idiot, but lazy. If you want to tell him to eat shit and die, my contact info is in my sig, I can not only take all the images out of your database, resize them all to what you want, and restore the LOCATION in the database, and edit the script itself to upload the image to your server and input the LOCATION in the database.', date=NOW()
:thumbsup

:1orglaugh:1orglaugh


All times are GMT -7. The time now is 09:14 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123