473,405 Members | 2,310 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Displaying Image on web page question

My .php app displays an image on the web page, I notice that different
..jpg images display "funny" - apparently they all have slightly
different image widths and heights yet in the image tag I have to set
those properties to something - is there a way in php to get an image
width and height so I can set it correctly for each image?

<IMG SRC="<?php echo $php_image ?>" WIDTH="268" HEIGHT="176"
BORDER="0" ALT="">

Jul 16 '05 #1
3 3622
Ahhhh...yes thank you.

BTW - when I write the .jpg file to my MySQL table, all I get is the
filename in the table col - I've defined the col as mediumblob to hold
the actual image but all I get is the filename - is there some kind of
trick to storing an image to a col?

Thanks...

On Mon, 25 Aug 2003 08:25:52 +1000, Matthew Vickers
<ke**@replies.in.ng> wrote:
On Sun, 24 Aug 2003 22:17:44 GMT
Ralph Freshour <ra***@primemail.com> wrote:
My .php app displays an image on the web page, I notice that different
.jpg images display "funny" - apparently they all have slightly
different image widths and heights yet in the image tag I have to set
those properties to something - is there a way in php to get an image
width and height so I can set it correctly for each image?

<IMG SRC="<?php echo $php_image ?>" WIDTH="268" HEIGHT="176"
BORDER="0" ALT="">


http://www.php.net/manual/en/function.getimagesize.php

Matt


Jul 16 '05 #2
But then some kind of image management scheme must be developed so
when records are deleted you don't end up with image files on the
server that don't belong to any records...???
On Mon, 25 Aug 2003 08:29:04 GMT, MeerKat
<li****************@blueyonder.co.uk> wrote:
Ralph Freshour wrote:
Ahhhh...yes thank you.

BTW - when I write the .jpg file to my MySQL table, all I get is the
filename in the table col - I've defined the col as mediumblob to hold
the actual image but all I get is the filename - is there some kind of
trick to storing an image to a col?


You've got to load in the contents of the file into a variable and save
this to the database. file_get_contents() would probably do it.

The standard response to this kind of question however, is don't store
the image in the database (the database can end up huge and clunky), but
store the filename of the image stored on the server.

MK.
Thanks...

On Mon, 25 Aug 2003 08:25:52 +1000, Matthew Vickers
<ke**@replies.in.ng> wrote:

On Sun, 24 Aug 2003 22:17:44 GMT
Ralph Freshour <ra***@primemail.com> wrote:
My .php app displays an image on the web page, I notice that different
.jpg images display "funny" - apparently they all have slightly
different image widths and heights yet in the image tag I have to set
those properties to something - is there a way in php to get an image
width and height so I can set it correctly for each image?

<IMG SRC="<?php echo $php_image ?>" WIDTH="268" HEIGHT="176"
BORDER="0" ALT="">

http://www.php.net/manual/en/function.getimagesize.php

Matt



Jul 16 '05 #3
Ralph Freshour wrote:
But then some kind of image management scheme must be developed so
when records are deleted you don't end up with image files on the
server that don't belong to any records...???


well, yes, you write sometyhing into your admin code (you did write an
admin interface, not just "use PHPMyAdmin", right?) to delete the files
as appropriate
Jul 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: matthiasjanes | last post by:
Hi, Maybe someone of you can help me. I'm trying to display an image in memory(open file) with an cgi script - but it want work proberly: I'm running an Cgi webserver (CgiServerGui.py). ...
4
by: pmud | last post by:
Hi, I have an image which resides on a different server...on data server. I am developing on Development server. When I use the image URLin my ASP.Net web page as ...
3
by: Irfan Akram | last post by:
Hi Guys, I am having problems displaying an image from the database, that alreday has been uoploaded successfully. The image loads in correctly, but by default it is displayed on the whole...
3
by: CD | last post by:
An application is logging faxes sent in SQL2000 image column type. I have found code on the net but what it is doing is prompting to save to local which is fine for single page image. Not good...
8
by: Lloyd Sheen | last post by:
I have a list of JPG's which are found in a SQL Server database. When the page selects a certain piece of data it will refer to the file system (resident on IIS server with a virtual directory)...
4
by: crazychrisy54 | last post by:
Hi there, I am new to JavaScript and wonder if it could be used to solve my problem, any help would be much appreciated! I have a html web page which contains a table on the left hand side and...
1
by: littlealex | last post by:
IE6 not displaying text correctly - IE 7 & Firefox 3 are fine! Need some help with this as fairly new to CSS! In IE6 the text for the following page doesn't display properly - rather than being...
7
by: hsegoy1979 | last post by:
Dear All Iam using file upload control and i want to display image in another pop up page .But image is not displaying in image control iam sending image path thru querystring . here is my code ...
5
by: kbnolan | last post by:
I'm somewhat new to this so I know there is something easy I'm missing. I'm editing an existing html page that was built with primarily with css. I have to work with the existing structure and not...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
Oralloy
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.