Programming Question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • FreeHugeMovies
    Too lazy to set a custom title
    • Dec 2001
    • 14141

    #1

    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
    So Fucking Banned
    • Aug 2003
    • 19593

    #2
    Firstly, his english sux. Secondly:

    Comment

    • pimplink
      Confirmed User
      • Jun 2001
      • 9535

      #3
      never heard something like that

      Need Mainstream Content and SEO?
      SEO * Website Copy * Blogs
      Blogging - PR Work - Forum Marketing - Social Marketing - Link building - Articles
      100% Guaranteed Content!

      Comment

      • FreeHugeMovies
        Too lazy to set a custom title
        • Dec 2001
        • 14141

        #4
        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.

        Comment

        • masterwebmonkey
          Registered User
          • Feb 2004
          • 93

          #5
          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.
          Programmer looking for work you can hit me here -> Master Web Monkey or ICQ 281945544
          PHP mySQL Flash ActionScript3 html javascitpt PERL::MECINIZE expect NATS MPA3 Responsys Interact

          Comment

          • masterwebmonkey
            Registered User
            • Feb 2004
            • 93

            #6
            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.
            Programmer looking for work you can hit me here -> Master Web Monkey or ICQ 281945544
            PHP mySQL Flash ActionScript3 html javascitpt PERL::MECINIZE expect NATS MPA3 Responsys Interact

            Comment

            • jwerd
              Confirmed User
              • Jun 2003
              • 1953

              #7
              Originally posted by masterwebmonkey
              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....
              Yii Framework Guru - Seasoned PHP vet - Partner @ XXXCoupon.com

              Comment

              • FreeHugeMovies
                Too lazy to set a custom title
                • Dec 2001
                • 14141

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

                Comment

                • masterwebmonkey
                  Registered User
                  • Feb 2004
                  • 93

                  #9
                  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.
                  Programmer looking for work you can hit me here -> Master Web Monkey or ICQ 281945544
                  PHP mySQL Flash ActionScript3 html javascitpt PERL::MECINIZE expect NATS MPA3 Responsys Interact

                  Comment

                  • FreeHugeMovies
                    Too lazy to set a custom title
                    • Dec 2001
                    • 14141

                    #10
                    Originally posted by masterwebmonkey
                    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

                    Comment

                    • masterwebmonkey
                      Registered User
                      • Feb 2004
                      • 93

                      #11
                      Originally posted by lamerhooD
                      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
                      Programmer looking for work you can hit me here -> Master Web Monkey or ICQ 281945544
                      PHP mySQL Flash ActionScript3 html javascitpt PERL::MECINIZE expect NATS MPA3 Responsys Interact

                      Comment

                      • masterwebmonkey
                        Registered User
                        • Feb 2004
                        • 93

                        #12
                        Originally posted by FreeHugeMovies
                        You lost me after MySQL
                        "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.
                        Programmer looking for work you can hit me here -> Master Web Monkey or ICQ 281945544
                        PHP mySQL Flash ActionScript3 html javascitpt PERL::MECINIZE expect NATS MPA3 Responsys Interact

                        Comment

                        • fallenmuffin
                          Confirmed User
                          • Nov 2005
                          • 8170

                          #13
                          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.

                          Comment

                          • fallenmuffin
                            Confirmed User
                            • Nov 2005
                            • 8170

                            #14
                            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);

                            Comment

                            • masterwebmonkey
                              Registered User
                              • Feb 2004
                              • 93

                              #15
                              giving away the farm ... ;-)
                              Programmer looking for work you can hit me here -> Master Web Monkey or ICQ 281945544
                              PHP mySQL Flash ActionScript3 html javascitpt PERL::MECINIZE expect NATS MPA3 Responsys Interact

                              Comment

                              • Killswitch - BANNED FOR LIFE

                                #16
                                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.

                                Comment

                                • ExLust
                                  Confirmed User
                                  • Aug 2008
                                  • 3223

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

                                  BE A PARTNER

                                  Comment

                                  • masterwebmonkey
                                    Registered User
                                    • Feb 2004
                                    • 93

                                    #18
                                    Did I mention I'm looking for work ...
                                    Programmer looking for work you can hit me here -> Master Web Monkey or ICQ 281945544
                                    PHP mySQL Flash ActionScript3 html javascitpt PERL::MECINIZE expect NATS MPA3 Responsys Interact

                                    Comment

                                    • Redrob
                                      Confirmed User
                                      • Oct 2004
                                      • 4791

                                      #19
                                      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.

                                      Comment

                                      • SeanLEE
                                        Confirmed User
                                        • Feb 2006
                                        • 1556

                                        #20
                                        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
                                        I spammed in threads!

                                        Comment

                                        • FreeHugeMovies
                                          Too lazy to set a custom title
                                          • Dec 2001
                                          • 14141

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

                                          Comment

                                          • FreeHugeMovies
                                            Too lazy to set a custom title
                                            • Dec 2001
                                            • 14141

                                            #22
                                            Originally posted by masterwebmonkey
                                            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!

                                            Comment

                                            • fallenmuffin
                                              Confirmed User
                                              • Nov 2005
                                              • 8170

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

                                              Comment

                                              • FreeHugeMovies
                                                Too lazy to set a custom title
                                                • Dec 2001
                                                • 14141

                                                #24
                                                Originally posted by fallenmuffin
                                                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.

                                                Comment

                                                • ExLust
                                                  Confirmed User
                                                  • Aug 2008
                                                  • 3223

                                                  #25
                                                  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.

                                                  BE A PARTNER

                                                  Comment

                                                  • Alky
                                                    Confirmed User
                                                    • Apr 2002
                                                    • 5651

                                                    #26
                                                    Originally posted by Redrob
                                                    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?

                                                    Comment

                                                    • FreeHugeMovies
                                                      Too lazy to set a custom title
                                                      • Dec 2001
                                                      • 14141

                                                      #27
                                                      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.
                                                      "

                                                      Comment

                                                      • jwerd
                                                        Confirmed User
                                                        • Jun 2003
                                                        • 1953

                                                        #28
                                                        Originally posted by FreeHugeMovies
                                                        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
                                                        Yii Framework Guru - Seasoned PHP vet - Partner @ XXXCoupon.com

                                                        Comment

                                                        • Killswitch - BANNED FOR LIFE

                                                          #29
                                                          Originally posted by lamerhooD
                                                          $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


                                                          Fire your programmer, he's worthless.

                                                          Comment

                                                          • woj
                                                            <&(©¿©)&>
                                                            • Jul 2002
                                                            • 47882

                                                            #30
                                                            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...
                                                            Last edited by woj; 02-24-2009, 07:57 AM.
                                                            Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000
                                                            Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager
                                                            Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager

                                                            Comment

                                                            • Zorgman
                                                              Confirmed User
                                                              • Aug 2002
                                                              • 6103

                                                              #31
                                                              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()
                                                              ---

                                                              Comment

                                                              • Killswitch - BANNED FOR LIFE

                                                                #32
                                                                Originally posted by Zorgman
                                                                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()

                                                                Comment

                                                                Working...