Classic ASP Thumbnail Issue

Hi

I have a search that returns results that contain image thumbnails, they are based on the main image which is uploaded via an admin page which is supposed to create a thumbnail image on uploading the main image.
The script uses Pure ASP Upload and seems to be working, ie. not giving errors, however, the file is not being created and therefore the page displays the default "Awaiting Image" pic.
I have attached 3 files results.txt, full-details.txt and add-images.txt all i believe self explanitory but to confirm, the add-images adds picture based on make model and should create thumbnail. The results.txt which displays the search results and the full-details.txt which works as the main image is present.
I would prefer to fix the thumbnail image issue but if not I would be happy with suggestions on how to use the main image scaled down without losing quality.

thank you for your assistance
full-details.txt
results.txt
add-images.txt
AndersonHitchenAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
Can you point to your documentation for resizing images?

What happened to trying out this solution?  http://www.experts-exchange.com/Programming/Languages/Scripting/ASP/Q_28652859.html#a40715881

Before testing it with uploading an image, try using an actual image already on the server.
AndersonHitchenAuthor Commented:
I have made some changes to the code as the results page was looking for the image in the table that housed the old images and not the table that relates to the car model image. I compared the code from the full-details page and added this to the results page
dim rsImages
dim strImages
Set rsImages = server.CreateObject("ADODB.RecordSet")
strImages = "SELECT * FROM carimages WHERE modelID = ('" & rsResult("fldModel_ID") & "') order by dateAdded desc"
rsImages.Open strImages, connilease_cmd

Open in new window


Removing
 strip back the main image extension to write the thumbnail to screen
'dim StrImg1
'if rsResult("fldImg1") <> "" then
'StrImg1 = rsResult("fldImg1")
'StrImg1 = Left(StrImg1, InStr(StrImg1, ".")-1)
'end if

Open in new window


I then changed the inc incThumbAndLinkedImages to accommodate the changes made to results. on testing I get this error

ADODB.Fields error '800a0cc1'
Item cannot be found in the collection corresponding to the requested name or ordinal.
/carsauce/includes/incThumbAndLinkedImages.asp, line 16
 which suggest that the column fldImages does not exist.

Where have I gone wrong?
AndersonHitchenAuthor Commented:
Oh yes Scott I did look at the location for the uploaded images, the main image is uploading fine and working in the full details page as it should.
That is why I asked if there might be a solution to adapt the code that I have and use this image instead of creating the thumbnail.

If you have a solution to do this and the image quality will not be affected to much this would be fine.

Cheers for the assistance.

M
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
Can you point to the online documentation for what you are using for image sizing?
AndersonHitchenAuthor Commented:
the site uses Pure ASP Upload to upload the file it is produced by DMX here is a link

http://www.dmxzone.com/go/12064/pure-asp-upload-3/

I checked the upload area for the thumbnails and still are not being uploaded.

As my previous message I have broke something now and the results page is showing the error posted.

Cheers again for the help Scott

If you what to view any other files let me know
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
It looks like the software for the dreamweaver plug in does all the coding for you http://www.dmxzone.com/go/12607/smart-image-processor-asp-2/  Is this how you are using it?

The best way to start is from a clean new asp page using only what you need to get this task done.  Then build out. So if we are working on resizing an image, start with an image that is already on the server and work on resizing it.  Once that is done, you can add uploading and finally updating your db. Taking it steps allows you to get rid of potential errors that have nothing to do with what you are working on.
AndersonHitchenAuthor Commented:
so you are basically saying to throw away the old pages and start again from scratch?... No something I feel we need to do in full as,,,

The upload page works, it uploads the image for the related make model and stores it to the database so i dont need to redo that.

if I have to recode the results page, it would only be in part where it writes the results to the screen as the search works fine.

I know its a little messy, i will clean it up later, as i said previously, I have picked up the site after it has been worked on by multiple developers hence the amount of comments and lack of convention. the last time it was worked on was 2010.

My thoughts are that if the full-details page works and returns the data with the uploaded images. All I have to do is to adjust the results page to call that image and then scale it down to fit the display? This is what I have been working on but without success so far.

Is this something you can assist with? If you can tell me what you need to assist and I will provide it.

Cheers M
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
Just for testing purposes.   It's possible that you have an error in one place that is causing an error someplace else.  This is just creating a simple test case http://sscce.org/

It is a lot easier to get it working and start adding back pieces like variables and database recordsets.

Otherwise, I would manually create breakpoints in multiple places in your code and test that variables and objects are what you expect.  

If you want to look just at the code, I pointed out previously that it looks like you have this set to overwrite.  So the image uploads, then resizes to the same name.  If you upload a file that is 900px wide, is that image there as 900px wide? or is it 231px wide as set below?  If it is 231, that means it is resizing, just being over written.  My guess is there should be a setting to create a smaller image with a different name.  Looking at the screen shot at http://www.dmxzone.com/go/12607/smart-image-processor-asp-2/ under the title, "New Interface for ease of use in Dreamweaver" there is a setting to not over write and rename the file. Is that the issue?
' Smart Image Processor 2.5.5
Dim sip1
Set sip1 = New ImageProcessor
sip1.Key = "8F0B5877-E2FA-446F-8B41-B8BD2E06BE29"
sip1.ScriptFolder = "../ScriptLibrary"
sip1.Component = "Auto"
sip1.Source = "upload"
sip1.AutoOrient = false
sip1.KeepMetaData = false
sip1.Matte = "#FFFFFF"
sip1.UploadFields = "img1"
sip1.GetFiles
While sip1.HasFiles
sip1.LoadFromSource
sip1.Resize 213, 141, true
sip1.Overwrite = true
sip1.SaveJPEG 80
sip1.MoveNext
Wend
Set sip1 = Nothing

Open in new window

AndersonHitchenAuthor Commented:
Hi Scott

Spent a week looking into this now have tried various options.

Heres my problem in lay-man terms... The image is being uploaded to the folder, the image is writting to the carimages database and is being returned as it should be in the full details page. It is not being brought back in the search results page and subsequently the default image is showing as the image being called by the results page is incorrect and does not exist. *** The site used to work on images uploaded for each vehicle offer, now images are uploaded for each make model to reduce workload ***

If you can help, I think the best way forward, instead of us bouncing round the houses, is for us to start at point A and work through to Z until we find the error.

So to start the ball rolling...

What we are creating is a set of results based on a search criteria as shown here, the images displayed relate to the model ID which is linked to the table carimages, the image is listed in the db and works in the full details page as shown here.  All I need the results page to do is show the image as in the full details page resized.

Code is very messy as it has had so many people work on it over the years and I have to say I am now struggling with it and need help sorting it ASAP.

If you tell me step at a time what you require to assist I will provide it.

Thanks again for the assistance.
Big MontyWeb Ninja at largeCommented:
jumping in per request of the user...

can you confirm the code below is where you expect the thumbnails to be generated?

<%
'*** Pure ASP File Upload 3.0.17
' Process form images
Dim pau, DMX_uploadAction, UploadRequest, UploadQueryString, pau_thePath, pau_nameConflict, pau_saveWidth, pau_saveHeight
Set pau = new PureUpload
pau.ScriptLibrary = "../ScriptLibrary"
pau.ConflictHandling = "over"
pau.StoreType = "file"
pau.ProgressTemplate = "vista_look.htm"
pau.ProgressWidth = 300
pau.ProgressHeight = 100
pau.UploadFolder = """../car-img"""
pau.ProcessUpload
pau.SaveAll
%>

<%
' Smart Image Processor 2.5.5
Dim sip1
Set sip1 = New ImageProcessor
sip1.Key = "8F0B5877-E2FA-446F-8B41-B8BD2E06BE29"
sip1.ScriptFolder = "../ScriptLibrary"
sip1.Component = "Auto"
sip1.Source = "upload"
sip1.AutoOrient = false
sip1.KeepMetaData = false
sip1.Matte = "#FFFFFF"
sip1.UploadFields = "img1"
sip1.GetFiles
While sip1.HasFiles
sip1.LoadFromSource
sip1.Resize 213, 141, true
sip1.Overwrite = true
sip1.SaveJPEG 80
sip1.MoveNext
Wend
Set sip1 = Nothing
%>

Open in new window

AndersonHitchenAuthor Commented:
I am not 100% as I believe that the smart image processor as I have already had to fix the link to the scriptLibrary as it was generating an error (parent Paths).

I have this include which I thought was generating the thumbs but it does not relate to where the location of the uploaded image as far as i can see.
 '****************** Thumb and linked Images ******************
		'* Block altered to:-
		'* 1) Fix the issue of image thumbs not appearing
		'* 2) Allow a default image to appear in the case if no image is found
		'* Will Munda 15th September 2010
		'
		'change to fldImage rather than fldimg1 to look in new db table
		
		dim fs
		dim VehicleImage
		dim VehicleImageThumb

		set fs=Server.CreateObject("Scripting.FileSystemObject")

		VehicleImage=lcase(rsResult.Fields.Item("fldImg1").Value)

		If fs.FileExists(Server.MapPath("/car-img/NEW/" & VehicleImage )) = False  then
			VehicleImage="default_thumb.gif"
		End if

		VehicleImageThumb=Replace(VehicleImage,".jpg","_thumb.jpg")

		If fs.FileExists(Server.MapPath("/car-img/NEW/" & VehicleImageThumb )) = False then
			VehicleImageThumb= "default_thumb.gif"
		End if

		set fs=nothing

Open in new window


Thanks for coming back to me.

M
Big MontyWeb Ninja at largeCommented:
no problem, happy to help :)

can you confirm whether or not the actual thumb nail images exist on the server?

also, are you tied to using your current component for resizing or would you be open to using another method? I ask because I know very little about Pure ASPUpload and have never used it, but I do have another (free) way of easily resizing images.
AndersonHitchenAuthor Commented:
Hi

No the thumb nail does not exist on the server just the main image uploaded.

Happy to look at another solution if it helps.

Cheers M
Big MontyWeb Ninja at largeCommented:
Let's look into another potential solution, if you don't like it, we can investigate why it's not being created, but this alternative solution is relatively quick to implement and I've used it successfully on a site I work on.

Have a look at this project:

http://www.imageresizing.quickersite.com/

It utilizes .NET image manipulation classes from a classic asp page by passing in the parameter of the path of the full size image to the component. Essentially download the files, stick them in a folder on your site, and wherever you want to resize an image, you would use code like:

<img src="/path/to/imageResizer/showthumb.aspx?r=<random value to prevent caching>&maxsize=<size you want image>&img=<path to full image>">

I suggest just trying a simple demo page with all of the values hard-coded to see if it works as you want it. The only thing I haven't tested is trying to resize a whole bunch of images on the same page and how it performs, so something to keep in mind as we progress

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AndersonHitchenAuthor Commented:
Cheers will give this a whirl and update you tomorrow. Thank you M
Martin LissOlder than dirtCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.