Hi,
I have a collection of images stored in a DB. They are there for the
purpose of a news system. When the user views the homepage it will
diplay cropped versions of the news where the user will them click the
'read more' link to view the entire article. It will also display a
thumbnail of the article image. As the image is stored at its full
display size in the DB I need to be able to resize it before outputing
it.
To display the image I use a PHP file called 'imageviewer.ph p' and pass
the unique idetifier as a GET parameter. Once the correct image data
column field has been queried I use the following line to output it
within the <img> tag:
echo pg_unescape_byt ea($imgdata); //PostgreSQL database
However, in this instance I need to be able to resize it to a thumbnail
image prior to outputting. How would I do this?
Cheers
Burnsy 6 2528 bi******@yahoo. co.uk wrote: Hi,
I have a collection of images stored in a DB. They are there for the purpose of a news system. When the user views the homepage it will diplay cropped versions of the news where the user will them click the 'read more' link to view the entire article. It will also display a thumbnail of the article image. As the image is stored at its full display size in the DB I need to be able to resize it before outputing it.
To display the image I use a PHP file called 'imageviewer.ph p' and pass the unique idetifier as a GET parameter. Once the correct image data column field has been queried I use the following line to output it within the <img> tag:
echo pg_unescape_byt ea($imgdata); //PostgreSQL database
However, in this instance I need to be able to resize it to a thumbnail image prior to outputting. How would I do this?
Cheers
Burnsy
Ok, not many replies. Can anybody tell me how this might be done with
an image stored in a MySQL db if possible? Cheers
Burnsy echo pg_unescape_byt ea($imgdata); //PostgreSQL database
However, in this instance I need to be able to resize it to a thumbnail image prior to outputting. How would I do this?
First <http://www.php.net/manual/en/function.imagec reatefromstring .php>
then <http://www.php.net/manual/en/function.imagec opyresized.php> or
<http://www.php.net/manual/en/function.imagec opyresampled.ph p>, then
<http://www.php.net/manual/en/function.imagej peg.php>, and finally
<http://www.php.net/manual/en/function.imaged estroy.php>.
---
Steve bi******@yahoo. co.uk wrote: I need to be able to resize it to a thumbnail image prior to outputting. How would I do this?
The easy answer is that you probably shouldn't do it at all.
Image resizing is a CPU-intensive process, so resizing should
be done once, when uploading the image to the server. The
resulting thumbnail would then be stored next to the full-size
image.
Also, the wisdom of storing images in databases is questionable.
If you have a PHP page with five images on it, every time someone
views it, six simultaneous connections to the database will be
opened.
For details on resizing, see documentation for imagecopyresize d()
and imagecopyresamp led() functions: http://www.php.net/imagecopyresized http://www.php.net/imagecopyresampled
Cheers,
NC
Steve wrote: echo pg_unescape_byt ea($imgdata); //PostgreSQL database
However, in this instance I need to be able to resize it to a thumbnail image prior to outputting. How would I do this?
First <http://www.php.net/manual/en/function.imagec reatefromstring .php> then <http://www.php.net/manual/en/function.imagec opyresized.php> or <http://www.php.net/manual/en/function.imagec opyresampled.ph p>, then <http://www.php.net/manual/en/function.imagej peg.php>, and finally <http://www.php.net/manual/en/function.imaged estroy.php>.
Some implementations won't have the JPEG support compiled in. There's
sometimes a program on UNIX systems called convert that can do what's
needed. http://www.die.net/doc/linux/man/man1/convert.1.html
Brian
hi every body
while i see alot of image functions in php but really i ever use one,
bissa...@yahoo. co.uk
i may adivse you to store 2 things :
1- the path in the DB of the small and big images you may need one
field the (image_path) and the add the big images path programatically .
2- you need also to store the image or you may need to create your own
uploade system to uploade the images (big and small), so you need to
upload the image twice the (small & big).
if you store the image in the DB in binary format i think it take a
time to be load and if it is more than 100KB it may reduce the
execution of your web page.
check it
A) You probably wouldn't want to store the image in th DB in the first
place
B) Since you've done that, save the image in the /tmp/ forlder after
reading it from the DB, resize that image and display it on the page.
C) If you plan on having lots of visualizations of the thumbnail,
you'll most probably want to save the image for future use... do this
by either :
1 - updating the DB with a pointer to the resized image
2 - Check if the file name of the thumbnail exists in a give Directory
before processing the image.
Preferably, you'd want to store a pointer in the DB of both the Thumb
and the main image.This way, you transfer less data between PHP and
MySQL, hence making your code quicker to execute. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Charles Packer |
last post by:
From one of the online Javascript tutorials, I learned how to
open a new window and set its size. I'm building a page that has
several small photographs, and I want to let the viewer examine
either a full size image or an image with supporting detail.
It's the same idea used on lots of Web sites that show thumbnails
where you click on one and the full-size image is displayed in a
new window. However, I have different-sized images that will...
|
by: John Scott |
last post by:
I am storing an image in an SQL database and have one field as an image
datatype. I am also using a webservice to transport data.
I want to be able to resize the image and pass back a thumbnail image in a
byte of what is in the database.
I also want to be able to display this image in an <asp:image></asp:image>
control.
Is there any way to do this? Most of the examples that I've seen have used
|
by: rams.kakara |
last post by:
hi,
My page have background image,on that image have more images and
text. My problem is whenever resize browser that images are not resized
and also not moved correct place .(i.e look not like before
alignment).I want to do everything in dyanamic. please help me.
urs..
Rams
|
by: Don |
last post by:
Does anyone know where I can find a client-side function I can reference from within an
HTML/JavaScript web page? I'm currently using a core PHP function to do this, but I'd rather do it
on the client-side and not have to upload the large raw image to the server.
Thanks in advance for your help.
Don
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in...
|
by: Robson Carvalho Machado |
last post by:
Dear Friends,
Does anybody knows how to use the below code with an image stored at SQL
Image field?
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
ScaleStatic("/website/images/default_03.jpg", 50)
End Sub
| |
by: Rudy |
last post by:
Hello all!
I been trying to get a handle with Images. I have learned alot from the fine
people here. So, I also learned that thumbnail images look terrible taken
from a digital cam. I know why they look bad. So what is the best way to
resize an image. I'm not too concerned about size, but I guess I would like
to compress it on the upload.
Any thoughts?
|
by: David Lozzi |
last post by:
Howdy,
I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders!
Now I am making a public function that will take the path of the uploaded image, and resize it with the provided dimensions. My function is below. The current function is returning an error when run from the upload function: A generic error occurred in GDI+. Not sure what exactly that means. From what...
|
by: =?Utf-8?B?UiBSZXllcw==?= |
last post by:
Hi!
This discussion may help other programmers get a better idea of how to save
uploaded images through a website.
Why? Well currently, I save 3 versions of every uploaded image on my own
little website:
1. Small: DOWNsize of original image to be used as a thumbnail.
2. Medium: DOWNsize of original image to be used as user avatars/icons in
forums or profiles.
|
by: simon2x1 |
last post by:
i have an image which width is 213 and height is 200 when
i echo the image and i resize it
echo "<img src='company/$present' width='70' height='68'/>";
the image was not as clear as when it was 213 * 200.how can i
make the image clear after i have resize it to 70 * 200.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |