Re: Thumb nail images to MySql

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

you are right. file trees offer much more possibilities like gathering
special file information like when the file was created / last accessed and
so on - I think its a good idea to leave the files as they are - saved in
folders :)

.ma


> what do you think of the idea of storing the thumbs with the originals
> in a db?

It's generally considered bad practice to store actual images in the
database,
but as you touched on, much of this is irrelevant with the power and
capacity of
modern servers.  Still, I prefer to keep images in the file tree so that
they
need not be accessed through the DB.  There are many cases when a query is
simply unnecessary and just adds to your code and overhead.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


Jeffrey_N_Dyke@Keane.com <Jeffrey_N_Dyke@Keane.com> wrote@05.05.2003 17:56
Uhr:

> Hello.  personally i like to save all images to my server and not the DB.
> I have built a script that will get all images in a directory and create a
> thumbnail for the image, ONLY, if one does not already exist in the
> 'thumbnail directory'.
> 
> I created a script to do this as i wanted to have a place to put all of my
> photographs.  Currently i upload the fullsize images to their respective
> directory and don't even have to worry about the thumbnail.  the first time
> a user requests that directory, the script will get all images in the
> directory and check the 'thumbnail' dir, based on the current image name,
> and if a thumb does not exist it creates one 1/4 of the size.  That way it
> is only using that processing power once and the remainder of the time it
> is just serving up static html.
> 
> i know i've completely sidestepped the db, thus making this way-off topic,
> but in my case, staying away from the db offers many advantages.
> 
> I'm happy to send my code to anyone that is interested, but didn't want to
> waste anymore bandwidth then i already have.
> 
> just my $.02....trying to show a different way.
> jd
> 
> 
>                  
>                     heilo
>                     <grillen@abendsti        To:       PHP-DB
> <php-db@lists.php.net>
>                     lle.at>                  cc:
>                                              Subject:  Re:  Thumb nail
> images to MySql  
>                     05/05/2003 09:17
>                     AM
>                  
>                  
> 
> 
> 
> 
> hi!
> 
> thx for the flowers :)
> Personally I prefer storing the images to a database and the moment i add
> the pics i also generate a thumbnail and save it also to the database. I
> know - this is not a very dynamic way, but i generated scripts which resize
> my whole thumbnaildatabase if so needed. furthermore with today's server
> the
> performance-argument loses actuality. the perfect thing with this script is
> that i can generate a config-file within i define a maxlength whereas the
> databases thumbnails size are already defined. but there is one big
> disadvantage of my script: it provides only JPEG. From gdlib there is also
> support for PNG, WBMP, and in older versions also GIF (however older
> versions doesn't support PNG). One could improve this script by
> distinguishing the mime-type with mime_content_type() or simple by
> extension. as I said there are _many_ image-manipulating-functions so there
> is also a ImageCreateFromPNG and ImageCreateFromGIF and so on....
> 
> what do you think of the idea of storing the thumbs with the originals in a
> db?
> 
> .ma
> 
> Becoming Digital <info@becomingdigital.com> wrote@05.05.2003 8:32 Uhr:
> 
>> Very nice, Heilo.  That's a better script than I would have offered.
> You're
>> quite right about the server load, though if the operations are not
> terribly
>> frequent it shouldn't be too bad.  At least the script is called only
> once per
>> image.
>> 
>> Edward Dudlik
>> Becoming Digital
>> www.becomingdigital.com
>> 
>> 
>> ----- Original Message -----
>> From: "heilo" <grillen@abendstille.at>
>> To: "PHP-DB" <php-db@lists.php.net>
>> Sent: Sunday, 04 May, 2003 08:33
>> Subject: Re:  Thumb nail images to MySql
>> 
>> 
>> hi!
>> 
>> The most dynamic way would be to use a little php-progg which returns an
>> image like this (there are _many_ functions for image-manipulation:
>> 
>> <?php
>>   header('Content-Type: iamge/jpeg');
>> 
>>   $imgReal = ImageCreateFromJPEG($_GET['pic']);
>>   $x = ImagesX($imgReal);
>>   $y = ImagesY($imgReal);
>> 
>>   // use a percentage to make the pic smaller
>>   if(isset($_GET['percent']))
>>   {
>>       $percent = (empty($_GET['percent'])) ? 15 : $_GET['percent'];
>>       $n_x = $percent/100 * $x;
>>       $n_y = $percent/100 * $y;
>>   }
>>   // use a maximum width (height is proportional)
>>   else
>>   {
>>       $maxWidth = (!isset($_GET['maxwidth'])||empty($_GET['maxwidth'])) ?
>> 100 : $_GET['maxwidth'];
>>       $newX = $maxWidth;
>>       $newY = $newX * $y / $x;
>>   }
>> 
>>   $img = ImageCreateTrueColor($newX, $newY);
>> 
>>   ImageCopyResampled($img, $imgReal, 0, 0, 0, 0, $newX, $newY, $x, $y);
>> 
>>   ImageJPEG($img);
>> ?>
>> 
>> You have to access this script this way:
>> 
>> <img src="ihavethecodeabove.php?pic=/path/to/file.jpg">
>> 
>> you have to remember that this script is called seperately by the browser
> so
>> the path to the pics must be ok for this script! Remember that this
> requires
>> enormous performance which _may_ cause long waiting times...
>> 
>> hope this helps?
>> 
>> .ma
>> 
>> Dave Carrera <dave@ephgroup.com> wrote@04.05.2003 14:12 Uhr:
>> 
>>> Hi all
>>> 
>>> I am in need of advise on how I can auto create a thumbnail image file,
> of a
>>> fixed size say 100x60, from my original upload image file uploaded to a
> set
>>> path and then write both paths to my MySql table fields "s_img" for the
>>> thumb and "l_img" for the large image.
>>> 
>>> I am not storing the image to the db rather uploading them the two
>>> directories .
>>> 
>>> Any help with this will be very much appreciated and I thank anyone in
>>> advance for any pointer or even better code examples
>>> 
>>> Dave C
>>> 
>>> ---
>>> Outgoing mail is certified Virus Free.
>>> Checked by AVG anti-virus system (http://www.grisoft.com).
>>> Version: 6.0.476 / Virus Database: 273 - Release Date: 24/04/2003
>>> 
>>> 
>>> 
>>> --
>>> PHP Database Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>> 
>> 
>> 
>> 
>> --
>> PHP Database Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>> 
>> 
>> 
> 
> 
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 
> 
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux