I got my PHP to pull up the images! It's exciting...ha
I have a field called "Picture" that stores the file name such as 1.jpg.
Then I concatenate the URL path in front of it. This way, I can always move
the files around and change my code one time instead of having to edit each
record..
Of course, this isn't the production code; I'm simply learning
functionality.
Sample Code in case you are wondering or have suggestions...
$query= "SELECT housesID, bedrooms, floors, baths, fireplaces, squarefeet,
price, yearbuilt, picture FROM tblhouses";
$result = mysql_query($query);
for ($count=0; $count < mysql_numrows($result); $count++)
{
$picture = mysql_result($result, $count, "picture");
$fullpicture = "http://www.mydomain.com/images/" . $picture;
echo("<img src=\"$fullpicture\"");
}
Thanks,
Grant
On 3/15/06, Jeromie Clark <[EMAIL PROTECTED]> wrote:
>
> Hi -
>
> At some point, fiddling with an FTP application no longer makes sense.
> If this is an application that's going to be used by a client in a
> production environment, I'd probably argue that it doesn't make sense at
> all.
>
> When your application scales to some critical point, you'll find
> yourself in a position where either re-entering images via your UI for
> small jobs, or implementing some image manipluation technique for larger
> problems makes the most sense.
>
> When your dataset is small, it probably doesn't matter -- but if your
> dataset does become larger, and I'm thinking even a couple thousand
> records, it's probably easier to just build a good management tool, and
> use it. By the time I've fired up my FTP app, logged in, navigated to
> the right directory, located the file I want and swapped it out, I could
> probably have just used the web tool I built.
>
> Plus, if this is in production, there's the potential issue of file
> ownership and permissions. You don't want a support call six months
> later because the end user can't update the image you uploaded via FTP.
> If you're processing file uploads from the browser via PHP (I would),
> and the FTP user owns the file instead of the Apache user, you've got a
> problem -- and one that your client's invariably going to want to have
> fixed RIGHT NOW. (and of course, it'll come up when you're on the 11th
> hour of a deadline for another client)
>
> I can appreciate the need to separate images into manageable directory
> sizes -- this can definitely simplify backing up or migrating data,
> especially if your dataset grows large enough to span multiple disks.
>
> The thing that I would caution against, would be relying on the "100
> image" assumption in your application logic.
> Looking at the directory size during the image creation process is
> totally cool.
>
> Using application logic to "find" your image, rather than associating
> the path and filename directly with the database record is another
> thing, and I would argue that you *really* want to avoid doing that.
> The cost of associating a hard path and filename with your image record
> is very low, and should you find (or find an urgent, dire need for) a
> better scheme for handling your images later, you won't have a huge
> migration headache on your hands.
>
> Best,
>
> Jeromie
>
>
> >If the site is larger, (more than about 500 properties), I divide the
> >images folder into subfolders, each of will hold 100 properties. It's
> >easy enough for PHP to do the calculation to find out which folder the
> >image will be in.
> >
> >Folder images/0000 holds images for properties 0 to 99
> >Folder images/0001 holds images for properties 100 to 999
> >
> >Although I do know that some people just bang all the images into one
> >folder, it then becomes a pain if I want to use my FTP program to fiddle
> >with something, because it only returns 2000 (?) files at once.
> >
> >
> >
> >>What about a
> >>million images?
> >>
> >>
> >
> >Then I will get someone else to figure out,
> >I will be able to afford it... <G>
> >
> >
> >
>
>
>
> The php_mysql group is dedicated to learn more about the PHP/MySQL web
> database possibilities through group learning.
>
>
> ------------------------------
> YAHOO! GROUPS LINKS
>
>
> - Visit your group "php_mysql<http://groups.yahoo.com/group/php_mysql>"
> on the web.
>
> - To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]<[EMAIL PROTECTED]>
>
> - Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/>.
>
>
> ------------------------------
>
[Non-text portions of this message have been removed]
The php_mysql group is dedicated to learn more about the PHP/MySQL web database
possibilities through group learning.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php_mysql/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/