Marc Bachman


I have a form which displays two values from a record, one is a text file, and the other is a jpeg, the text file and the jpeg are in adjacent controls. I have gotten the text to display with some effort, but some of the jpegs just won't display. They have been adjusted to a pixel dimension convention so that they are optimally sized, and under 100kb. In and earlier thread, I was advised that since I was using a grid control on a form to enter the data that I might experience some problems, but I'm not sure whether this may be an effect of using the grid control. I have eliminated whitespace from the filenames in question, all the images reside in an "image" folder under C:\Program Files\MyProgram\images, and are not enclosed in any other folders. Some of the jpegs display, others do not. Some were resized, some were not, and there does not appear to be any relation between the source of the file(s), and/or whether they were resized and their capacity to display on the form. Please suggest what I might try to solve this problem. A search of these forum threads has not suggested a similar post.

Thanks,

Marc




Re: intermittent failure to display jpegs on form

Naomi Nosonovsky


Would you please specify your VFP version I think I saw a similar topic on a different forum related to VFP9 and problems with displaying some JPGs. I can make a search.

Also are you showing images in a grid or in an image control on the form Do you have CLEAR RESOURCES between assignments of the value






Re: intermittent failure to display jpegs on form

Marc Bachman

My version is 9.0.SP1.I have also run VFP9SP0RT1 on the production machine that I'm testing on. I * presume * I have an image control on the form, ( there is no grid on the display form, just on the data entry form ) I will check. As for CLEAR RESOURCES, I would guess that to be code, but, because I am new to VFP, I'm not sure where to locate . If it is a property of the control, I'll look there. I already spent some time at Tek-Tips looking, and know that I should be looking for myself. If you can suggest a list of appropriate forums, etc. I already know about fox.wiki ( a little more advanced ) and Tek Tips. I have also heard here about "foxite" and "Universal Threads" which I will add to my list. Update: I have a Picture property of the control that has the path to the image. I am unable to locate any property of the control or the form that indicates a "CLEAR RESOURCE" setting. I am not aware of how I might examine the properties of the form by its name, I am able to look at the properties of "Frm1" which I presume is the form I'm looking at which is the one in question.

Thank You,.
Marc





Re: intermittent failure to display jpegs on form

Naomi Nosonovsky

Hi Marc,

I was not clear yesterday in my suggestion, sorry. I meant, that in the code that sets picture property of the Image control to the image file, there should be added a line

CLEAR RESOURCES

thisform.myImage.Picture = alltrim(MyTable.MyJPGField) && where this field contains path to the jpg file (if it just contains the name, add Image Dir in front)

The list of VFP related forums can be found at http://fox.wikis.com/wc.dll Wiki~VisualFoxProLinks

Look for links with * in front. I personally can recommend www.UniversalThread.com www.foxite.com www.tek-tips.com I also visit good VFP forum in Russian www.foxclub.ru

Anyway, I found the dicussion I was talking about and there is an explanation at Calvin Hsia veblog http://blogs.msdn.com/calvin_hsia/archive/2005/07/24/442873.aspx

You may try to use PictureVal property, see, if it will solve the problem for you.





Re: intermittent failure to display jpegs on form

Marc Bachman

It works!
I would like to discuss at a little greater length your suggestion:

<in the code that sets picture property of the Image control to the image file, there should be added a line

CLEAR RESOURCES

thisform.myImage.value = alltrim(MyTable.MyJPGField) && where this field contains path to the jpg file (if it just contains the name, add Image Dir in front) >

Here is the code for my main.prg, which I assume is where I where I would need to insert the lines you suggested.



=myInstance("programname")

close tables
Clear All
IF FILE('forms\welcome_screen.scx')
Set Default To 'C:\os_efx'
ELSE
SET Default TO SYS(5) + CURDIR()
ENDIF
Set Path To 'os_efx' AddI
Set Path To 'forms' AddI
Set Path To 'classes' AddI
Set Path To 'database' AddI
Set Path To 'code' AddI

Set Classlib To pvbase,pvmus Additive

_screen.AlwaysOnTop = .T.

_Screen.BackColor = 2
_Screen.Visible = .F.

_screen.AutoCenter = .t.
_screen.MinButton = .f.

_screen.Enabled = .F.

_Screen.Closable = .F.
_Screen.AutoCenter = .T.
_Screen.WindowState = 2
_Screen.Caption = ""
set escape off
set bell on
Set Talk Off
Set Status Off
Set Status Bar Off
Set Sysmenu Off
SET SAFETY OFF

PUBLIC PagesArray
DIMENSION PagesArray[1]


Open Database 'CENTRAL' Exclusive
use person
PACK
use
USE p_data
PACK
use
use cat_lin
PACK
USE

Public oApp As Object
_Screen.AddProperty('curr_form','')
_Screen.Visible = .T.
_Screen.AddObject('oApp','papp')


*-do shutdown
Clear All
Release All Extended

_Screen.RemoveObject('oApp')
Do doshutdown

Set Sysmenu To Defa
Set Status On
Set Status Bar On
******************************************
PROCEDURE myInstance
PARAMETERS myApp
=ddesetoption("SAFETY",.F.)
ichannel = DDEINITIATE(myapp,"ZOOM")
IF ichannel =>0
=DDETERMINATE(ichannel)
QUIT
ENDIF
=DDESETSERVICE(myapp,"define")
=DDESETSERVICE(myapp,"execute")
=DDESETTOPIC(myapp,"","ddezoom")
RETURN
******************************************
PROCEDURE ddezoom
PARAMETER ichannel,saction,sitem,sdata,sformat,istatus
ZOOM WINDOW SCREEN NORM
RETURN
**********************************************************
** EOF
**********************************************************



The workaround was that I used Irfanview to batch convert/rename the files from their previous names to "imagexxx" ( xxx means 001-999 )and after that I was able to use all the images with no problem. I had also tried using Irfanview to remove exif tags, but that had not enabled the display of the problem images.

Is there a limitation for file name length, as applied to image files Anyway another lesson learned!

Many Thanks,
Marc





Re: intermittent failure to display jpegs on form

Naomi Nosonovsky

Hi Marc,

I don't think the code from your main program is relevant to the problem we're discussing. The CLEAR RESOURCES should be put in the form where you display the picture just before the line that assigns picture property (or PictureVal property).

I'm not sure about limitation to file name length specific to image files, but for general path/file name limitations you may check http://www.berezniker.com/display/VFP/Determine+Invalid+Characters+in+File+Name+and+Path and http://www.berezniker.com/display/VFP/Windows+limitations+on+file+and+path+name





Re: intermittent failure to display jpegs on form

Naomi Nosonovsky

So, what exactly was the solution for the problem



Re: intermittent failure to display jpegs on form

Naomi Nosonovsky

So, was your solution to re-save offending files