Re: Thumb nail images to MySql

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

 



> 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


----- Original Message -----
From: "heilo" <grillen@abendstille.at>
To: "PHP-DB" <php-db@lists.php.net>
Sent: Monday, 05 May, 2003 09:17
Subject: Re:  Thumb nail images to MySql


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
>>
>
> Matthias Steinböck
> Email: grillen@abendstille.at
> Web: http://www.abendstille.at
>
> Frühabendliches Webdesign.
> ------------------------------------------
> Im Übrigen sind wir der Meinung, dass
> Platon immer schon Recht hatte:
> Gabeln links vom Teller, Messer rechts
> Und Löffel oben drüber.
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

Matthias Steinböck
Email: grillen@abendstille.at
Web: http://www.abendstille.at

Frühabendliches Webdesign.
------------------------------------------
Im Übrigen sind wir der Meinung, dass
Jeder Mensch mit dem lebenswichtigen
Fuss-Schrubbomat2000 ausgestattet
Sein sollte.


--
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