[PHP] Adding a in try.jpg!
I have a new very intriguing problem at hand. I have the name of my Images stored in my mySQL database in one column. Now when i pick the images, they are displayed as it as. However, they are the big images, and the thumbnails of those images are stored with an a at the end of thier names. That is, If the image is try.jpg , the thumbnail of the image is trya.jpg !! Now i want to display the thumbnail and not the large image. And unfortunately, my whole database contains the name of Large images and NOt the Thumbnails. How can i : 1. Insert a at the end of the name of the image, before the .extension through PHP. The problems are that the names are stored in the database WITH the extesion. And the extensions also vary, some are JPG and some are GIF. So in my datase i have images as try.jpg or something.gif! How can i insert an a at the end of the name before the . ? 2. OR.. can i insert the a before the . in the image name in my mySQL database itself. Either of the two solutions can work for me. Thanks, T. Edison Jr. __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Adding a in try.jpg!
(untested) $newname = eregi_replace('\.jpg$', 'a.jpg', $oldname); No point messing up your database; just use something like the above when you're outputting the image tags for the thumbnails. miguel On Mon, 8 Apr 2002, Thomas Edison Jr. wrote: I have a new very intriguing problem at hand. I have the name of my Images stored in my mySQL database in one column. Now when i pick the images, they are displayed as it as. However, they are the big images, and the thumbnails of those images are stored with an a at the end of thier names. That is, If the image is try.jpg , the thumbnail of the image is trya.jpg !! Now i want to display the thumbnail and not the large image. And unfortunately, my whole database contains the name of Large images and NOt the Thumbnails. How can i : 1. Insert a at the end of the name of the image, before the .extension through PHP. The problems are that the names are stored in the database WITH the extesion. And the extensions also vary, some are JPG and some are GIF. So in my datase i have images as try.jpg or something.gif! How can i insert an a at the end of the name before the . ? 2. OR.. can i insert the a before the . in the image name in my mySQL database itself. Either of the two solutions can work for me. Thanks, T. Edison Jr. __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Adding a in try.jpg!
$parts = preg_split('/\./', $filename); $new_filename = $parts[0] . a.jpg; (Not tested, but _should_ work.) /bsh/ Thomas Edison Jr. wrote: I have a new very intriguing problem at hand. I have the name of my Images stored in my mySQL database in one column. Now when i pick the images, they are displayed as it as. However, they are the big images, and the thumbnails of those images are stored with an a at the end of thier names. That is, If the image is try.jpg , the thumbnail of the image is trya.jpg !! Now i want to display the thumbnail and not the large image. And unfortunately, my whole database contains the name of Large images and NOt the Thumbnails. How can i : 1. Insert a at the end of the name of the image, before the .extension through PHP. The problems are that the names are stored in the database WITH the extesion. And the extensions also vary, some are JPG and some are GIF. So in my datase i have images as try.jpg or something.gif! How can i insert an a at the end of the name before the . ? 2. OR.. can i insert the a before the . in the image name in my mySQL database itself. Either of the two solutions can work for me. Thanks, T. Edison Jr. __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ -- /-=[ BILLY S HALSEY ]=--\ | Member of Technical Staff, Sun Microsystems, Inc. ESP Solaris SW | | All opinions and technical advice offered in this message are my | | own and not necessarily endorsed by my employer. | \--=[ [EMAIL PROTECTED] ]=/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Adding a in try.jpg!
On Monday 08 April 2002 15:41, Thomas Edison Jr. wrote: How can i : 1. Insert a at the end of the name of the image, before the .extension through PHP. The problems are that the names are stored in the database WITH the extesion. And the extensions also vary, some are JPG and some are GIF. So in my datase i have images as try.jpg or something.gif! How can i insert an a at the end of the name before the . ? 2. OR.. can i insert the a before the . in the image name in my mySQL database itself. Loads of ways to do it. Here's one: explode() the file name on . then concatenate an a onto the second from last element, then implode(). -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Don't worry. Life's too long. -- Vincent Sardi, Jr. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Adding a in try.jpg! Problems!
Hi, Thanks for your relies. There are a couple of problems. Firstly, i'm picking the filename from the database, so my code is something like this : if ($myrow = mysql_fetch_array($result)) { do { echo( img src=\images\\$myrow[ilmage]\ ); } while ($myrow = mysql_fetch_array($result)); } Now the filename is actually stored in $myrow[ilmage] How do i perform the spliting adding functions on $myrow[ilmage] ?? Secondly, all images are not .JPG, some are jpg others are gif !!! Thank you.. T. Edison Jr. --- Miguel Cruz [EMAIL PROTECTED] wrote: (untested) $newname = eregi_replace('\.jpg$', 'a.jpg', $oldname); No point messing up your database; just use something like the above when you're outputting the image tags for the thumbnails. miguel On Mon, 8 Apr 2002, Thomas Edison Jr. wrote: I have a new very intriguing problem at hand. I have the name of my Images stored in my mySQL database in one column. Now when i pick the images, they are displayed as it as. However, they are the big images, and the thumbnails of those images are stored with an a at the end of thier names. That is, If the image is try.jpg , the thumbnail of the image is trya.jpg !! Now i want to display the thumbnail and not the large image. And unfortunately, my whole database contains the name of Large images and NOt the Thumbnails. How can i : 1. Insert a at the end of the name of the image, before the .extension through PHP. The problems are that the names are stored in the database WITH the extesion. And the extensions also vary, some are JPG and some are GIF. So in my datase i have images as try.jpg or something.gif! How can i insert an a at the end of the name before the . ? 2. OR.. can i insert the a before the . in the image name in my mySQL database itself. Either of the two solutions can work for me. Thanks, T. Edison Jr. __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ = Rahul S. Johari (Director) ** Abraxas Technologies Inc. Homepage : http://www.abraxastech.com Email : [EMAIL PROTECTED] Tel : 91-4546512/4522124 *** __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Adding a in try.jpg! Problems!
$thumbnail = eregi_replace('\.jpg$', 'a.jpg', $myrow['ilmage']); $thumbnail = eregi_replace('\.gif$', 'a.gif', $thumbnail); It's no problem to do it twice in a row; it'll pick up one or the other. miguel On Mon, 8 Apr 2002, Thomas Edison Jr. wrote: Hi, Thanks for your relies. There are a couple of problems. Firstly, i'm picking the filename from the database, so my code is something like this : if ($myrow = mysql_fetch_array($result)) { do { echo( img src=\images\\$myrow[ilmage]\ ); } while ($myrow = mysql_fetch_array($result)); } Now the filename is actually stored in $myrow[ilmage] How do i perform the spliting adding functions on $myrow[ilmage] ?? Secondly, all images are not .JPG, some are jpg others are gif !!! Thank you.. T. Edison Jr. --- Miguel Cruz [EMAIL PROTECTED] wrote: (untested) $newname = eregi_replace('\.jpg$', 'a.jpg', $oldname); No point messing up your database; just use something like the above when you're outputting the image tags for the thumbnails. miguel On Mon, 8 Apr 2002, Thomas Edison Jr. wrote: I have a new very intriguing problem at hand. I have the name of my Images stored in my mySQL database in one column. Now when i pick the images, they are displayed as it as. However, they are the big images, and the thumbnails of those images are stored with an a at the end of thier names. That is, If the image is try.jpg , the thumbnail of the image is trya.jpg !! Now i want to display the thumbnail and not the large image. And unfortunately, my whole database contains the name of Large images and NOt the Thumbnails. How can i : 1. Insert a at the end of the name of the image, before the .extension through PHP. The problems are that the names are stored in the database WITH the extesion. And the extensions also vary, some are JPG and some are GIF. So in my datase i have images as try.jpg or something.gif! How can i insert an a at the end of the name before the . ? 2. OR.. can i insert the a before the . in the image name in my mySQL database itself. Either of the two solutions can work for me. Thanks, T. Edison Jr. __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ = Rahul S. Johari (Director) ** Abraxas Technologies Inc. Homepage : http://www.abraxastech.com Email : [EMAIL PROTECTED] Tel : 91-4546512/4522124 *** __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Adding a in try.jpg! Problems!
Do the explode and implodes like that one fellow mentioned. So basically: while ($myrow = mysql_fetch_array($result)) { $img = explode('.',$myrow[ilmage]); echo img src=\images/{$img[0]}a$img[1]\br / } What this will do is take your image split the image at the '.' then echo it with the 'a'.. Hope it helps! Rick Be kind. Everyone you meet is fighting a hard battle - John Watson From: Thomas Edison Jr. [EMAIL PROTECTED] Date: Mon, 8 Apr 2002 01:17:51 -0700 (PDT) To: Miguel Cruz [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Adding a in try.jpg! Problems! Hi, Thanks for your relies. There are a couple of problems. Firstly, i'm picking the filename from the database, so my code is something like this : if ($myrow = mysql_fetch_array($result)) { do { echo( img src=\images\\$myrow[ilmage]\ ); } while ($myrow = mysql_fetch_array($result)); } Now the filename is actually stored in $myrow[ilmage] How do i perform the spliting adding functions on $myrow[ilmage] ?? Secondly, all images are not .JPG, some are jpg others are gif !!! Thank you.. T. Edison Jr. --- Miguel Cruz [EMAIL PROTECTED] wrote: (untested) $newname = eregi_replace('\.jpg$', 'a.jpg', $oldname); No point messing up your database; just use something like the above when you're outputting the image tags for the thumbnails. miguel On Mon, 8 Apr 2002, Thomas Edison Jr. wrote: I have a new very intriguing problem at hand. I have the name of my Images stored in my mySQL database in one column. Now when i pick the images, they are displayed as it as. However, they are the big images, and the thumbnails of those images are stored with an a at the end of thier names. That is, If the image is try.jpg , the thumbnail of the image is trya.jpg !! Now i want to display the thumbnail and not the large image. And unfortunately, my whole database contains the name of Large images and NOt the Thumbnails. How can i : 1. Insert a at the end of the name of the image, before the .extension through PHP. The problems are that the names are stored in the database WITH the extesion. And the extensions also vary, some are JPG and some are GIF. So in my datase i have images as try.jpg or something.gif! How can i insert an a at the end of the name before the . ? 2. OR.. can i insert the a before the . in the image name in my mySQL database itself. Either of the two solutions can work for me. Thanks, T. Edison Jr. __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ = Rahul S. Johari (Director) ** Abraxas Technologies Inc. Homepage : http://www.abraxastech.com Email : [EMAIL PROTECTED] Tel : 91-4546512/4522124 *** __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Adding a in try.jpg! SOLVED!!
Hi, Thanks.. actually that problem is solved, this is what i used : $myrow[ilmage] = eregi_replace('\.jpg$', 'a.jpg', $myrow[ilmage]); $myrow[ilmage] = eregi_replace('\.gif$', 'a.gif', $myrow[ilmage]); and it's now showing the small images with the a!! Thanks AGAIN! T. Edison Jr. --- Miguel Cruz [EMAIL PROTECTED] wrote: (untested) $newname = eregi_replace('\.jpg$', 'a.jpg', $oldname); No point messing up your database; just use something like the above when you're outputting the image tags for the thumbnails. miguel On Mon, 8 Apr 2002, Thomas Edison Jr. wrote: I have a new very intriguing problem at hand. I have the name of my Images stored in my mySQL database in one column. Now when i pick the images, they are displayed as it as. However, they are the big images, and the thumbnails of those images are stored with an a at the end of thier names. That is, If the image is try.jpg , the thumbnail of the image is trya.jpg !! Now i want to display the thumbnail and not the large image. And unfortunately, my whole database contains the name of Large images and NOt the Thumbnails. How can i : 1. Insert a at the end of the name of the image, before the .extension through PHP. The problems are that the names are stored in the database WITH the extesion. And the extensions also vary, some are JPG and some are GIF. So in my datase i have images as try.jpg or something.gif! How can i insert an a at the end of the name before the . ? 2. OR.. can i insert the a before the . in the image name in my mySQL database itself. Either of the two solutions can work for me. Thanks, T. Edison Jr. __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ = Rahul S. Johari (Director) ** Abraxas Technologies Inc. Homepage : http://www.abraxastech.com Email : [EMAIL PROTECTED] Tel : 91-4546512/4522124 *** __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Adding a in try.jpg! Problems!
$myrow[ilmage] = eregi_replace((\.[^\.]+)$, a\\1, $myrow[ilmage]); and if ilmage isn't a constant use $myrow[ilmage]. Thomas Edison Jr. [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi, Thanks for your relies. There are a couple of problems. Firstly, i'm picking the filename from the database, so my code is something like this : if ($myrow = mysql_fetch_array($result)) { do { echo( img src=\images\\$myrow[ilmage]\ ); } while ($myrow = mysql_fetch_array($result)); } Now the filename is actually stored in $myrow[ilmage] How do i perform the spliting adding functions on $myrow[ilmage] ?? Secondly, all images are not .JPG, some are jpg others are gif !!! Thank you.. T. Edison Jr. --- Miguel Cruz [EMAIL PROTECTED] wrote: (untested) $newname = eregi_replace('\.jpg$', 'a.jpg', $oldname); No point messing up your database; just use something like the above when you're outputting the image tags for the thumbnails. miguel On Mon, 8 Apr 2002, Thomas Edison Jr. wrote: I have a new very intriguing problem at hand. I have the name of my Images stored in my mySQL database in one column. Now when i pick the images, they are displayed as it as. However, they are the big images, and the thumbnails of those images are stored with an a at the end of thier names. That is, If the image is try.jpg , the thumbnail of the image is trya.jpg !! Now i want to display the thumbnail and not the large image. And unfortunately, my whole database contains the name of Large images and NOt the Thumbnails. How can i : 1. Insert a at the end of the name of the image, before the .extension through PHP. The problems are that the names are stored in the database WITH the extesion. And the extensions also vary, some are JPG and some are GIF. So in my datase i have images as try.jpg or something.gif! How can i insert an a at the end of the name before the . ? 2. OR.. can i insert the a before the . in the image name in my mySQL database itself. Either of the two solutions can work for me. Thanks, T. Edison Jr. __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ = Rahul S. Johari (Director) ** Abraxas Technologies Inc. Homepage : http://www.abraxastech.com Email : [EMAIL PROTECTED] Tel : 91-4546512/4522124 *** __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Adding a in try.jpg! Problems!
but if $myrow[ilmage] = hallo.hmm.gif; your code won't work. so better: while ($myrow = mysql_fetch_array($result)) { $img = explode('.',$myrow[ilmage]); $img[count($img) - 1] .= a; echo img src=\images/.implode('.', $img).\br /; } Richard Baskett [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Do the explode and implodes like that one fellow mentioned. So basically: while ($myrow = mysql_fetch_array($result)) { $img = explode('.',$myrow[ilmage]); echo img src=\images/{$img[0]}a$img[1]\br / } What this will do is take your image split the image at the '.' then echo it with the 'a'.. Hope it helps! Rick Be kind. Everyone you meet is fighting a hard battle - John Watson From: Thomas Edison Jr. [EMAIL PROTECTED] Date: Mon, 8 Apr 2002 01:17:51 -0700 (PDT) To: Miguel Cruz [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Adding a in try.jpg! Problems! Hi, Thanks for your relies. There are a couple of problems. Firstly, i'm picking the filename from the database, so my code is something like this : if ($myrow = mysql_fetch_array($result)) { do { echo( img src=\images\\$myrow[ilmage]\ ); } while ($myrow = mysql_fetch_array($result)); } Now the filename is actually stored in $myrow[ilmage] How do i perform the spliting adding functions on $myrow[ilmage] ?? Secondly, all images are not .JPG, some are jpg others are gif !!! Thank you.. T. Edison Jr. --- Miguel Cruz [EMAIL PROTECTED] wrote: (untested) $newname = eregi_replace('\.jpg$', 'a.jpg', $oldname); No point messing up your database; just use something like the above when you're outputting the image tags for the thumbnails. miguel On Mon, 8 Apr 2002, Thomas Edison Jr. wrote: I have a new very intriguing problem at hand. I have the name of my Images stored in my mySQL database in one column. Now when i pick the images, they are displayed as it as. However, they are the big images, and the thumbnails of those images are stored with an a at the end of thier names. That is, If the image is try.jpg , the thumbnail of the image is trya.jpg !! Now i want to display the thumbnail and not the large image. And unfortunately, my whole database contains the name of Large images and NOt the Thumbnails. How can i : 1. Insert a at the end of the name of the image, before the .extension through PHP. The problems are that the names are stored in the database WITH the extesion. And the extensions also vary, some are JPG and some are GIF. So in my datase i have images as try.jpg or something.gif! How can i insert an a at the end of the name before the . ? 2. OR.. can i insert the a before the . in the image name in my mySQL database itself. Either of the two solutions can work for me. Thanks, T. Edison Jr. __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ = Rahul S. Johari (Director) ** Abraxas Technologies Inc. Homepage : http://www.abraxastech.com Email : [EMAIL PROTECTED] Tel : 91-4546512/4522124 *** __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Adding a in try.jpg! Problems!
typo..this one's right :) while ($myrow = mysql_fetch_array($result)) { $img = explode('.',$myrow[ilmage]); $img[count($img) - 2] .= a; echo img src=\images/.implode('.', $img).\br /; } Michael Virnstein [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... but if $myrow[ilmage] = hallo.hmm.gif; your code won't work. so better: while ($myrow = mysql_fetch_array($result)) { $img = explode('.',$myrow[ilmage]); $img[count($img) - 1] .= a; echo img src=\images/.implode('.', $img).\br /; } Richard Baskett [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Do the explode and implodes like that one fellow mentioned. So basically: while ($myrow = mysql_fetch_array($result)) { $img = explode('.',$myrow[ilmage]); echo img src=\images/{$img[0]}a$img[1]\br / } What this will do is take your image split the image at the '.' then echo it with the 'a'.. Hope it helps! Rick Be kind. Everyone you meet is fighting a hard battle - John Watson From: Thomas Edison Jr. [EMAIL PROTECTED] Date: Mon, 8 Apr 2002 01:17:51 -0700 (PDT) To: Miguel Cruz [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Adding a in try.jpg! Problems! Hi, Thanks for your relies. There are a couple of problems. Firstly, i'm picking the filename from the database, so my code is something like this : if ($myrow = mysql_fetch_array($result)) { do { echo( img src=\images\\$myrow[ilmage]\ ); } while ($myrow = mysql_fetch_array($result)); } Now the filename is actually stored in $myrow[ilmage] How do i perform the spliting adding functions on $myrow[ilmage] ?? Secondly, all images are not .JPG, some are jpg others are gif !!! Thank you.. T. Edison Jr. --- Miguel Cruz [EMAIL PROTECTED] wrote: (untested) $newname = eregi_replace('\.jpg$', 'a.jpg', $oldname); No point messing up your database; just use something like the above when you're outputting the image tags for the thumbnails. miguel On Mon, 8 Apr 2002, Thomas Edison Jr. wrote: I have a new very intriguing problem at hand. I have the name of my Images stored in my mySQL database in one column. Now when i pick the images, they are displayed as it as. However, they are the big images, and the thumbnails of those images are stored with an a at the end of thier names. That is, If the image is try.jpg , the thumbnail of the image is trya.jpg !! Now i want to display the thumbnail and not the large image. And unfortunately, my whole database contains the name of Large images and NOt the Thumbnails. How can i : 1. Insert a at the end of the name of the image, before the .extension through PHP. The problems are that the names are stored in the database WITH the extesion. And the extensions also vary, some are JPG and some are GIF. So in my datase i have images as try.jpg or something.gif! How can i insert an a at the end of the name before the . ? 2. OR.. can i insert the a before the . in the image name in my mySQL database itself. Either of the two solutions can work for me. Thanks, T. Edison Jr. __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ = Rahul S. Johari (Director) ** Abraxas Technologies Inc. Homepage : http://www.abraxastech.com Email : [EMAIL PROTECTED] Tel : 91-4546512/4522124 *** __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php