Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QUESTION Image verification
#1
Can somebody verify that code for me and write why it is not working? http://pastebin.com/dXPYW2Cm

I want to make a code which will check if there's an image and - if it is - show it. Im using GetSimple tags to generate image address (like mysite.com/data/uploads/pageslug.jpg), but this code is not working, IDK why.
Glowczynski.pl - webmaster, graphic designer, translator.
For any job offers contact me via artur@glowczynski.pl.
Reply
#2
You are using urls instead of filepaths you need the actual file path $GSROOT etc
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#3
(2016-10-31, 06:49:00)shawn_a Wrote: You are using urls instead of filepaths you need the actual file path $GSROOT etc

Could you write that code for me to make it work? I'm trying to do that on my own but it still doesn't work.
Glowczynski.pl - webmaster, graphic designer, translator.
For any job offers contact me via artur@glowczynski.pl.
Reply
#4
PHP Code:
<?php
$filename 
GSDATAUPLOADPATH .  get_page_slug() . '.jpg';
$fileurl get_site_url() . 'data/uploads/' get_page_slug() . '.jpg'
something like that, you are already in php also , why do you have inline php tags
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#5
(2016-10-31, 23:32:49)shawn_a Wrote:
PHP Code:
<?php
$filename 
GSDATAUPLOADPATH  get_page_slug() . '.jpg';
$fileurl get_site_url() . 'data/uploads/' get_page_slug() . '.jpg'
something like that, you are already in php also , why do you have inline php tags

Code was written by my friend, because I am not a PHP master, but I wanted a feature I cannot write on my own. Wink


I made something like this:


PHP Code:
<?php
$filename 
GSDATAUPLOADPATH  get_page_slug() . '.jpg';
$fileurl get_site_url() . 'data/uploads/' get_page_slug() . '.jpg';

$headers=get_headers($filename);
 
if (
$headers[0] == 'HTTP/1.1 200 OK') {
 
   echo $fileurl;
} else {
 
   echo "";
?>
But after saving it shows something like this: sample-pagehttp://base.kingarchee.pl/getsimple/demos/gsStellar/sample-page whitout .jpg format and proper address.
Glowczynski.pl - webmaster, graphic designer, translator.
For any job offers contact me via artur@glowczynski.pl.
Reply
#6
What are you trying to do why are you outputing headers i thought you were editing your template, it looks like you are making a dynamic im request file.
Just modify your template
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#7
I made a theme which has ability to show .jpg images on specified page if this image has the slug in it's name. Like if i have /sample-page/, it will show sample-page.jpg file. But if there's no image, the broken link will occur. I want to delete this broken link and show nothing when there's no such image, and show it if it is in uploads.
Glowczynski.pl - webmaster, graphic designer, translator.
For any job offers contact me via artur@glowczynski.pl.
Reply
#8
PHP Code:
<?php if (file_exists(GSDATAUPLOADPATH.get_page_slug(false).'.jpg')) { ?>
  <span class="image main"><img src="<?php get_site_url(); ?>data/uploads/<?php get_page_slug(); ?>.jpg" alt="" /></span>
<?php ?>
Reply
#9
(2016-11-01, 18:02:41)Carlos Wrote:
PHP Code:
<?php if (file_exists(GSDATAUPLOADPATH.get_page_slug(false).'.jpg')) { ?>
  <span class="image main"><img src="<?php get_site_url(); ?>data/uploads/<?php get_page_slug(); ?>.jpg" alt="" /></span>
<?php ?>       

Nice, it works! Thank you very much, Carlos. Smile
Glowczynski.pl - webmaster, graphic designer, translator.
For any job offers contact me via artur@glowczynski.pl.
Reply




Users browsing this thread: 1 Guest(s)