Forums

This topic is locked

Tumbnail Problem

Posted 21 Feb 2006 03:04:09
1
has voted
21 Feb 2006 03:04:09 Michael Ryan posted:
I'm using Pure Asp to upload pictures create a thumbnail to a SQL Database.
Thumbsnail get name "filename"_small.jpg. just like they are supposed to.
I have looked at all the tuturials about displaying thumbnails in RS Field.
i'm using the DMX Thumbnail as my source

<%= Thumbnail("_small",(RSNewest.Fields.Item("PicPath".Value)) %>

But all i get is an error


Microsoft VBScript runtime error '800a000d'

Type mismatch: 'Thumbnail'

/Main.asp, line 272


Please help i'm pulling my hair out and i can't afford that.

Replies

Replied 21 Feb 2006 04:55:37
21 Feb 2006 04:55:37 Javier Castro replied:
Hi Michael,

your code should look a little like :

<img src="changethistoyourimagedirectory/<%=(RSNewest.Fields.Item("_small".Value)%>" alt="" border="0" />

good luck,

Javier
Replied 21 Feb 2006 05:04:01
21 Feb 2006 05:04:01 Michael Ryan replied:
Thanks but i try that and now i get

ADODB.Fields error '800a0cc1'

Item cannot be found in the collection corresponding to the requested name or ordinal.

/TMPw7nauv0nwa.asp, line 272



This is my code
<img src="/Pics/Women/<%=(RSNewest.Fields.Item("_small".Value)%>" alt="" border="0" />
Replied 21 Feb 2006 05:12:36
21 Feb 2006 05:12:36 Javier Castro replied:
<img src="/Pics/Women/<%=(RSNewest.Fields.Item("_small".Value)%>" alt="" border="0" />


-small: should be your field name on your db not the file my code in my application is as follows:

<img src="cat_thumbnails/<%=(rsBaby.Fields.Item("product_image".Value)%>" alt="" border="0" />

cat_thumbnails = my directory

rsBaby = my recordset

product_image = the field where the names of my files are stored

is your like that?
Replied 21 Feb 2006 05:21:07
21 Feb 2006 05:21:07 Michael Ryan replied:
No your right my mistake but it still doesn't work.

The Upload creates a thumbnail in the same dirctory pis/women like this "PicName"_small.jpg

I can get it to show the record source if it is just the "PicName" using the full path in the database.

But if i want to show the created thumbnail in the directory it doesn't work.

Does that make any sense?
Replied 21 Feb 2006 05:28:48
21 Feb 2006 05:28:48 Michael Ryan replied:
I assume their maybe either something wrong with this code that is created or where it is being placed.

<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>
function Thumbnail(tmb_suff,tmb_filename)
Dim tmb_NewFilename, tmb_Path, tmb_PosPath, tmb_PosExt
if not isnull(tmb_filename) then
tmb_PosPath = InStrRev(tmb_filename,"/"
tmb_Path = ""
if tmb_PosPath > 0 then
tmb_Path = mid(tmb_filename,1,tmb_PosPath)
end if
tmb_PosExt = InStrRev(tmb_filename,"."
if tmb_PosExt > 0 then
tmb_NewFilename = tmb_Path & mid(tmb_filename,tmb_PosPath+1,tmb_PosExt-(tmb_PosPath+1)) & tmb_suff & ".jpg"
else
tmb_NewFilename = tmb_Path & mid(tmb_filename,tmb_PosPath+1,len(tmb_filename)-tmb_PosPath) & tmb_suff & ".jpg"
end if
end if
Thumbnail = tmb_NewFilename
end function
</SCRIPT>
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
Replied 21 Feb 2006 05:35:19
21 Feb 2006 05:35:19 Javier Castro replied:
Sorry, I think you better ask to the Guys at PureASP. Just a little above my head this last bit of code... I tried. Good luck and post your success.

Javier
Replied 21 Feb 2006 05:39:41
21 Feb 2006 05:39:41 Michael Ryan replied:
will do thanks anyhow.
Replied 21 Feb 2006 05:45:10
21 Feb 2006 05:45:10 Javier Castro replied:
probably you have tried this but just in case you haven't

<img src="/Pics/Women/<%=("_small",(RSNewest.Fields.Item("PicPath".Value)) %>" alt="" border="0" />



Replied 21 Feb 2006 05:46:30
21 Feb 2006 05:46:30 Michael Ryan replied:
Yes Sir no go.
Replied 08 Aug 2006 22:40:26
08 Aug 2006 22:40:26 Coda  replied:
Looks like Javier was close. Try this example: <img SRC="<%= PicName %>_small.jpg" class="floatleftimage" alt="<%= AltText%>">
Make sure your image is pathed correctly and it will show up.
Coda
Replied 16 Aug 2007 17:49:51
16 Aug 2007 17:49:51 Dave Bevan replied:
In case anyone else is still trying to fix this problem, this is a solution I found works for me.
Edit to suit your database references and paste into the picture scr box in dreamweaver.

pics/picsgallery/<%=Replace(YourRecordsetRS.Fields.Item("yourpicname".Value,".jpg",""%>_thumb.jpg

You don't need the thumbnail name to be stored in your database as all your thumbnails are named the same as the larger pic, but with "_thumb.jpg" on the end.
The other solutions offered here added "_thumb.jpg" after the .jpg in the original file name.
So this code removes the .jpg reference from the file name in your database, and adds _thumb.jpg in the correct place.
It works for me anyway!

Reply to this topic